enhance: rename :key/value to :kv/value

experiment/tanstack-table
Tienson Qin 2024-05-24 15:21:10 +08:00
parent db7c4e2145
commit 8458b6b21b
8 changed files with 28 additions and 12 deletions

View File

@ -504,7 +504,7 @@
;; And prefer this local graph UUID when picking an ID for new rtc graph?
(defn get-graph-rtc-uuid
[db]
(when db (:key/value (d/entity db :logseq.kv/graph-uuid))))
(when db (:kv/value (d/entity db :logseq.kv/graph-uuid))))
(def page? sqlite-util/page?)
(defn class?

View File

@ -15,7 +15,7 @@
(defn db-based-graph?
"Whether the current graph is db-only"
[db]
(= "db" (:key/value (d/entity db :logseq.kv/db-type))))
(= "db" (:kv/value (d/entity db :logseq.kv/db-type))))
(def lookup-entity @#'entity/lookup-entity)
(defn lookup-kv-then-entity

View File

@ -395,7 +395,7 @@
(def db-ident-keys
"Enumerates all possible keys db-ident key vals"
[[:key/value :any]])
[[:kv/value :any]])
(def db-ident-key-val
"A key-val map consists of a :db/ident and a specific key val"

View File

@ -6,7 +6,7 @@
;; A page is a special block, a page can corresponds to multiple files with the same ":block/name".
(def ^:large-vars/data-var schema
{:db/ident {:db/unique :db.unique/identity}
:key/value {}
:kv/value {}
:recent/pages {}

View File

@ -35,7 +35,7 @@
(if (namespace key)
(str (namespace key) "-" (name key))
(name key)))
:key/value value})
:kv/value value})
(def built-in-pages-names
#{"Contents"})

View File

@ -37,3 +37,19 @@ in db-version, page-references(e.g. [[page-name]]) are stored as [[~^uuid]]."
"like `:block/content`,
but when eval `(:block/raw-content block-entity)`, return raw-content of this block"
:string)
(sr/defkeyword :kv/value
"Used to store key-value, the value could be anything, e.g. {:db/ident :logseq.kv/xxx :kv/value value}"
:any)
(sr/defkeyword :class/parent
"A class's parent class")
(sr/defkeyword :class/schema.properties
"Class properties that all of its objects can use, notice that it's different from this class's own properties.")
(sr/defkeyword :block/closed-value-property
"The property that this closed value (an Entity) belongs to.")
(sr/defkeyword :property/schema.classes
"The classes that this property value must to sastify (being an object of a class)")

View File

@ -133,7 +133,7 @@
(defn combine-local-&-remote-graphs
[local-repos remote-repos]
(when-let [repos' (seq (concat (map (fn [{:keys [sync-meta metadata] :as repo}]
(let [graph-id (or (:key/value metadata) (second sync-meta))]
(let [graph-id (or (:kv/value metadata) (second sync-meta))]
(if graph-id (assoc repo :GraphUUID graph-id) repo)))
local-repos)
(some->> remote-repos

View File

@ -120,9 +120,9 @@
(if-let [graph-uuid (:graph-uuid upload-resp)]
(let [^js worker-obj (:worker/object @worker-state/*state)]
(ldb/transact! conn
[{:db/ident :logseq.kv/graph-uuid :key/value graph-uuid}
{:db/ident :logseq.kv/graph-local-tx :key/value "0"}])
(m/? (c.m/await-promise (.storeMetadata worker-obj repo (pr-str {:key/value graph-uuid}))))
[{:db/ident :logseq.kv/graph-uuid :kv/value graph-uuid}
{:db/ident :logseq.kv/graph-local-tx :kv/value "0"}])
(m/? (c.m/await-promise (.storeMetadata worker-obj repo (pr-str {:kv/value graph-uuid}))))
(op-mem-layer/init-empty-ops-store! repo)
(op-mem-layer/update-graph-uuid! repo graph-uuid)
(op-mem-layer/update-local-tx! repo 8)
@ -203,8 +203,8 @@
blocks-with-page-id (fill-block-fields blocks)
tx-data (concat blocks-with-page-id
[{:db/ident :logseq.kv/graph-uuid :key/value graph-uuid}])
init-tx-data [{:db/ident :logseq.kv/db-type :key/value "db"}]
[{:db/ident :logseq.kv/graph-uuid :kv/value graph-uuid}])
init-tx-data [{:db/ident :logseq.kv/db-type :kv/value "db"}]
^js worker-obj (:worker/object @worker-state/*state)]
(m/sp
(op-mem-layer/update-local-tx! repo t)
@ -268,6 +268,6 @@
(m/? (new-task--transact-remote-all-blocks all-blocks repo graph-uuid))
(op-mem-layer/update-graph-uuid! repo graph-uuid)
(m/? (op-mem-layer/new-task--sync-to-idb repo))
(m/? (c.m/await-promise (.storeMetadata worker-obj repo (pr-str {:key/value graph-uuid}))))
(m/? (c.m/await-promise (.storeMetadata worker-obj repo (pr-str {:kv/value graph-uuid}))))
(worker-state/set-rtc-downloading-graph! false)
nil)))))