Skip to content

Instantly share code, notes, and snippets.

@stuarthalloway
Created April 28, 2012 14:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuarthalloway/2519604 to your computer and use it in GitHub Desktop.
Save stuarthalloway/2519604 to your computer and use it in GitHub Desktop.
Add database functions and bytes value types to Datomic
;; Builds of Datomic with revision numbers higher than 0.1.3057 have
;; support for :db.type/fn, :db.type/bytes, and :db/fn.
;; To add these types to a database created using with a pre-0.1.3057
;; build, simply run the database with a newer version of Datomic, and
;; execute the two transactions below.
[{:db/id #db/id [:db.part/db]
:db/ident :db.type/bytes
:fressian/tag :bytes
:db/doc "Value type for small binaries. Maps to byte array on the JVM."
:db.install/_valueType :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :db.type/fn
:fressian/tag :datomic/fn
:db/doc "Value type for database functions. See Javadoc for Peer.function."
:db.install/_valueType :db.part/db}]
[{:db/id #db/id [:db.part/db]
:db/ident :db/fn
:db/valueType :db.type/fn
:db/cardinality :db.cardinality/one
:db/doc "A function-valued attribute for direct use by transactions and queries."
:db.install/_attribute :db.part/db}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment