This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-11
Channels
- # aleph (7)
- # bangalore-clj (11)
- # boot (70)
- # cider (11)
- # cljsjs (3)
- # cljsrn (17)
- # clojure (88)
- # clojure-brasil (8)
- # clojure-dev (17)
- # clojure-greece (1)
- # clojure-italy (6)
- # clojure-poland (8)
- # clojure-russia (2)
- # clojure-spec (44)
- # clojure-uk (32)
- # clojurescript (176)
- # cloverage (2)
- # component (5)
- # cursive (3)
- # datomic (23)
- # defnpodcast (6)
- # dirac (15)
- # emacs (6)
- # garden (19)
- # hoplon (126)
- # leiningen (1)
- # off-topic (3)
- # om (66)
- # onyx (56)
- # re-frame (8)
- # reagent (7)
- # ring-swagger (43)
- # specter (18)
- # untangled (110)
- # vim (3)
- # yada (39)
think about it, @hueyp — it’ll always be a coll. several things may have entity alpha as its one thing. having datomic enforce that only one thing has entity alpha adds a lot of busy-work to quite a lot of the api for not much gain.
wasn’t sure if there was some unique constraint magic I didn’t know about is all (you can get the behavior with components)
I’m having trouble using Clojure spec to validate Datomic entities, specifically using clojure.spec/keys since that requires the input to be a map. Any thoughts on that?
Here’s a simple example:
(s/def ::age number?)
(s/def ::name string?)
(s/def ::person (s/keys :req [::name ::age]))
(def person-entity (d/entity (d/db conn) [:person/name "Mr entity"]))
(s/explain ::person person-entity)
val: #:db{:id 17592186069950} fails spec: :some-ns/person predicate: map?
You could call d/touch
on the entity first
@danielstockton that is still not a map
basically this:
(defn to-map [input]
(if (= (type input) EntityMap)
(d/pull (d/db conn) '[*] (:db/id input))
input))
(s/def ::person2 (s/and (s/conformer to-map) ::person))
That looks OK, what's missing?
touch works more than one level deep, right? so that might work, if you can convert the touched EntityMap into a clojure map
i thought that pull also worked for nested entities
I'm looking for a generic solution for how to use spec with datomic, and I'm thinking my current solution is not the best way to go about it
count me also interested
Is there a way to have a persistent datomic database without a separate transactor process? (for development)
@martinklepsch Persistent requires you to use a separate txor via DEV or FREE protocol. If persistent is not a requirement you can use MEM protocol.
ok. hoped there might be something that doesn't require me to start another process
but it's a database after all so I probably should just accept it 🙂 thanks @jaret
welcome to the wonderful world of datomic, @martinklepsch !
yeah, so if you update to the latest version of datomic, make very sure to update your aws-sdk too 🙈