|
|
@@ -1,30 +1,17 @@
|
|
|
(ns logseq.db.common.property-util
|
|
|
"Property related util fns. Fns used in both DB and file graphs should go here"
|
|
|
(:require [datascript.core :as d]
|
|
|
- [logseq.db.common.entity-plus :as entity-plus]
|
|
|
[logseq.db.frontend.property :as db-property]
|
|
|
[logseq.db.sqlite.util :as sqlite-util]))
|
|
|
|
|
|
-(defn- get-file-pid-by-ident
|
|
|
- [db-ident]
|
|
|
- (get-in db-property/built-in-properties [db-ident :name] (name db-ident)))
|
|
|
-
|
|
|
-;; TODO: refactor later to remove this fn
|
|
|
+;; TODO: replace repo with db later to remove this fn
|
|
|
(defn get-pid
|
|
|
"Get a built-in property's id (keyword name for file graph and db-ident for db
|
|
|
graph) given its db-ident. No need to use this fn in a db graph only context"
|
|
|
[repo db-ident]
|
|
|
(if (sqlite-util/db-based-graph? repo)
|
|
|
db-ident
|
|
|
- (get-file-pid-by-ident db-ident)))
|
|
|
-
|
|
|
-(defn get-pid-2
|
|
|
- "Get a built-in property's id (keyword name for file graph and db-ident for db
|
|
|
- graph) given its db-ident. No need to use this fn in a db graph only context"
|
|
|
- [db db-ident]
|
|
|
- (if (entity-plus/db-based-graph? db)
|
|
|
- db-ident
|
|
|
- (get-file-pid-by-ident db-ident)))
|
|
|
+ (get-in db-property/built-in-properties [db-ident :name] (name db-ident))))
|
|
|
|
|
|
(defn lookup
|
|
|
"Get the property value by a built-in property's db-ident from coll. For file and db graphs"
|