This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-09
Channels
- # announcements (1)
- # arachne (1)
- # beginners (34)
- # boot (5)
- # calva (68)
- # cider (34)
- # cljs-dev (1)
- # clojure (36)
- # clojure-italy (8)
- # clojure-spec (16)
- # clojure-uk (58)
- # clojurescript (29)
- # cursive (2)
- # datascript (9)
- # datomic (3)
- # emacs (10)
- # figwheel (1)
- # figwheel-main (11)
- # fulcro (33)
- # luminus (5)
- # mount (2)
- # nrepl (42)
- # off-topic (3)
- # other-languages (2)
- # parinfer (3)
- # perun (4)
- # prelude (3)
- # re-frame (6)
- # reagent (5)
- # shadow-cljs (23)
- # sql (37)
- # testing (1)
@tonsky, first - welcome back, second - are there plans to add a persistence backend to DS anytime soon?
in the browser, or on the client side?
browsers are clients, so I assume you meant server. I don't see much use in a browser for anything other than the all-or-nothing serialization that is in ds now. for clj, cljs/node, something along the datahike path would be what I would be interested in hearing about. Maybe that question is already answered by dhike. Interested if there are alternate agendas
Question about Datascript schema: From a cursory look at the tests, it seems like the only purpose of schema in Datascript is so you can get it back out later with (:schema @conn)
. There is no other benefit to passing schema into your db instance, correct?
isn't schema necessary for basic querying and inserting? In particular, cardinality. Datascript must know if you are adding to a collection (card many) or replacing a single attribute (card one) right?
(let [schema {:aka {:db/cardinality :db.cardinality/many}}
conn (d/create-conn)]
(d/transact! conn [ { :db/id -1
:name "Maksim"
:age 45
:aka ["Max Otto von Stierlitz", "Jack Ryan"] } ])
(d/q '[:find ?age ?aka
:where
[?e :name "Maksim"]
[?e :age ?age]
[?e :aka ?aka]]
@conn))
from the first example from the readme. If this is run with create-conn given no schema, this query returns
#{[45 ["Max Otto von Stierlitz" "Jack Ryan"]]}
.Running with the schema included it returns #{[45 "Jack Ryan"] [45 "Max Otto von Stierlitz"]}
Ah, ok. Thanks. Is there any thing else that counts as the "special behavior" mentioned in the docs?
i'm looking for all of the schema that is supported but i can't find it. I see references to uniqueness, and declaring something is a ref. Ie, if it points to another thing in the db itself. for instance {:car/type 3}. Is this the integer 3 or the db/id 3 which could be {:manufacturer/make "subaru" :manufacturer/model "brz"} or whatever