Skip to content
This repository has been archived by the owner on Dec 7, 2024. It is now read-only.

Commit

Permalink
adds xt-id to put
Browse files Browse the repository at this point in the history
  • Loading branch information
naomijub committed Apr 25, 2023
1 parent e186b53 commit 1b8fdcb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion resources/transactions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ message Transaction {
}

message Put {
google.protobuf.Value document = 1;
string xt_id = 1;
google.protobuf.Value document = 2;
}

message Delete {
Expand Down
13 changes: 8 additions & 5 deletions src/com/xtdb/protos.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,24 @@
;-----------------------------------------------------------------------------
; Put
;-----------------------------------------------------------------------------
(defrecord Put-record [document]
(defrecord Put-record [xt-id document]
pb/Writer
(serialize [this os]
(serdes.core/write-embedded 1 (:document this) os))
(serdes.core/write-String 1 {:optimize true} (:xt-id this) os)
(serdes.core/write-embedded 2 (:document this) os))
pb/TypeReflection
(gettype [this]
"com.xtdb.protos.Put"))

(s/def ::Put-spec (s/keys :opt-un []))
(def Put-defaults {})
(s/def :com.xtdb.protos.Put/xt-id string?)

(s/def ::Put-spec (s/keys :opt-un [:com.xtdb.protos.Put/xt-id]))
(def Put-defaults {:xt-id ""})

(defn cis->Put
"CodedInputStream to Put"
[is]
(map->Put-record (tag-map Put-defaults (fn [tag index] (case index 1 [:document (com.google.protobuf/ecis->Value is)] [index (serdes.core/cis->undefined tag is)])) is)))
(map->Put-record (tag-map Put-defaults (fn [tag index] (case index 1 [:xt-id (serdes.core/cis->String is)] 2 [:document (com.google.protobuf/ecis->Value is)] [index (serdes.core/cis->undefined tag is)])) is)))

(defn ecis->Put
"Embedded CodedInputStream to Put"
Expand Down

0 comments on commit 1b8fdcb

Please sign in to comment.