fix: remove unused transit and other db-util helpers

also fix lint
pull/11102/head
Gabriel Horner 2024-03-07 10:41:39 -05:00
parent 2a17e04aa2
commit 12b6ded0e4
5 changed files with 3 additions and 24 deletions

View File

@ -23,10 +23,7 @@
remove-conn!]
[frontend.db.utils
db->edn-str db->string get-max-tx-id get-tx-id
group-by-page seq-flatten
string->db
entity pull pull-many transact! get-key-value]
[frontend.db.model

View File

@ -2,22 +2,12 @@
"Some utils are required by other namespace in frontend.db package."
(:require [datascript.core :as d]
[frontend.state :as state]
[datascript.transit :as dt]
[frontend.db.conn :as conn]
[frontend.config :as config]
[logseq.db.frontend.content :as db-content]))
;; transit serialization
(defn db->string [db]
(dt/write-transit-str db))
(defn db->edn-str [db]
(pr-str db))
(defn string->db [s]
(dt/read-transit-str s))
(defn seq-flatten [col]
(flatten (seq col)))
@ -28,13 +18,6 @@
(group-by :block/page))
blocks))
(defn get-tx-id [tx-report]
(get-in tx-report [:tempids :db/current-tx]))
(defn get-max-tx-id
[db]
(:max-tx db))
(defn entity
"This function will return nil if passed `id-or-lookup-ref` is an integer and
the entity doesn't exist in db.

View File

@ -4,7 +4,6 @@
[datascript.storage :refer [IStorage]]
[clojure.edn :as edn]
[datascript.core :as d]
[datascript.transit :as dt]
[logseq.db.sqlite.common-db :as sqlite-common-db]
[shadow.cljs.modern :refer [defclass]]
["@logseq/sqlite-wasm" :default sqlite3InitModule]

View File

@ -14,8 +14,7 @@
[frontend.handler.worker :as worker-handler]
[logseq.db :as ldb]
[frontend.db.transact :as db-transact]
[frontend.date :as date]
[datascript.transit :as dt]))
[frontend.date :as date]))
(defonce *worker state/*db-worker)

View File

@ -3,6 +3,7 @@
application"
(:require [frontend.state :as state]
[datascript.core :as d]
[datascript.transit :as dt]
[frontend.db :as db]
[rum.core :as rum]
[frontend.handler.route :as route-handler]
@ -58,7 +59,7 @@
(state/set-current-repo! repo)
(p/let [_ (repo-handler/restore-and-setup-repo! repo)
_ (let [data (unescape-html data)
db (db/string->db data)
db (dt/read-transit-str data)
datoms (d/datoms db :eavt)]
(db/transact! repo datoms {:init-db? true
:new-graph? true}))]