Skip to content

Instantly share code, notes, and snippets.

@rauhs
Created June 28, 2016 09:46
Show Gist options
  • Save rauhs/3bf96b33f37f051859d5071cdde70148 to your computer and use it in GitHub Desktop.
Save rauhs/3bf96b33f37f051859d5071cdde70148 to your computer and use it in GitHub Desktop.
(spec/def :datascript.db/id int?)
(spec/def :datomic.db/id #(instance? DbId %))
(spec/def :db/id (spec/or :datascript :datascript.db/id
:datomic :datomic.db/id))
(defn datomic-id?
"Checks a conformed spec and ensures the :db/id was a datomic id"
[{[kw] :db/id}]
(= kw :datomic))
(defn datascript-id?
"Checks a conformed spec and ensures the :db/id was a datascript id"
[{[kw] :db/id}]
(= kw :datascript))
(spec/def :object.abstract/schema (spec/keys :req [:db/id]))
(spec/def :object.from-client/schema
(spec/and :object.abstract/schema
datascript-id?))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment