We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0eca251 commit 277f533Copy full SHA for 277f533
2 files changed
src/datascript/core.cljc
@@ -190,6 +190,11 @@
190
Used internally in db (de)serialization. See also [[datom]]."}
191
init-db db/init-db)
192
193
+; Schema
194
+
195
+(def ^{:arglists '([db])
196
+ :doc "Returns a schema of a database."}
197
+ schema db/-schema)
198
199
; Filtered db
200
test/datascript/test/issues.cljc
@@ -43,3 +43,9 @@
43
(ds/db-with [[:db/add 1 :attr "aa"]]))]
44
(t/is (= [[(ds/datom 1 :attr :aa)] [(ds/datom 1 :attr "aa")] nil]
45
(clojure.data/diff db1 db2)))))
46
47
+(deftest ^{:doc "Expose a schema as a part of the public API."}
48
+ issue-381
49
+ (let [schema {:aka {:db/cardinality :db.cardinality/many}}
50
+ db (ds/empty-db schema)]
51
+ (t/is (= schema (ds/schema db)))))
0 commit comments