This repository has been archived by the owner on Dec 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd8cc94
commit 4514f39
Showing
2 changed files
with
9 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,7 @@ | ||
(ns gxtdb.adapters.db | ||
(:require [gxtdb.adapters.tx-time :refer [->clj-time]] | ||
[gxtdb.utils :refer [not-nil?]] | ||
[xtdb.api :as xt])) | ||
|
||
(defn ->db-basis [params] | ||
(let [valid-time (some-> params :valid-time ->clj-time) | ||
tx-time (some-> params :tx-time ->clj-time) | ||
tx-id (some-> params :tx-id :value :some)] | ||
(case [(not-nil? valid-time) (not-nil? tx-time) (not-nil? tx-id)] | ||
[true true true] {::xt/valid-time valid-time} | ||
[true false false] {::xt/valid-time valid-time} | ||
[true true false] {::xt/valid-time valid-time ::xt/tx-time tx-time} | ||
[true false true] {::xt/valid-time valid-time ::xt/tx tx-id} | ||
[false true false] {::xt/tx-time tx-time} | ||
[false false true] {::xt/tx tx-id} | ||
nil))) | ||
(:require [gxtdb.utils :as utils])) | ||
|
||
(defn db-basis->proto [db-basis-reponse] | ||
{:xt-id (-> db-basis-reponse :xt/id str) | ||
:valid-time (-> db-basis-reponse :xtdb.api/valid-time utils/->inst-str) | ||
:tx-time (-> db-basis-reponse :xtdb.api/tx-time utils/->inst-str)}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters