Skip to content

Instantly share code, notes, and snippets.

@hhutch
Forked from stuarthalloway/gist:2321773
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hhutch/10a9bc112f0c10ead2ab to your computer and use it in GitHub Desktop.
Save hhutch/10a9bc112f0c10ead2ab to your computer and use it in GitHub Desktop.
;; Datomic sample code
;; schema query for attribute types in specified namespaces
(q '[:find ?attr
:in $ [?include-ns ...] ;; bind ?include-ns once for each item in collection
:where
[?e :db/valueType] ;; all schema types (must have a valueType)
[?e :db/ident ?attr] ;; schema type name
[(datomic.Util/namespace ?attr) ?ns] ;; namespace of name
[(= ?ns ?include-ns)]] ;; must match one of the ?include-ns
(db conn)
["db.install" "fressian"]) ;; collection for ?include-ns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment