Skip to content

Instantly share code, notes, and snippets.

@mtnygard
Created May 20, 2013 20:29
Show Gist options
  • Save mtnygard/5615250 to your computer and use it in GitHub Desktop.
Save mtnygard/5615250 to your computer and use it in GitHub Desktop.
Query for all data types supported in Datomic.
user> (require '[datomic.api :as d])
nil
user> (def conn (d/connect (doto "datomic:mem://temp" d/create-database)))
#'user/conn
user> (d/q '[:find ?type ?doc :where
[_ :db.install/valueType ?t]
[?t :db/ident ?type]
[?t :db/doc ?doc]]
(d/db conn))
#{[:db.type/long "Fixed integer value type. Same semantics as a Java long: 64 bits wide, two's complement binary representation."]
[:db.type/double "Floating point value type. Same semantics as a Java double: double-precision 64-bit IEEE 754 floating point."]
[:db.type/uuid "Value type for UUIDs. Maps to java.util.UUID on the JVM."]
[:db.type/keyword "Value type for keywords. Keywords are used as names, and are interned for efficiency. Keywords map to the native interned-name type in languages that support them."]
[:db.type/bigdec "Value type for arbitrary precision floating point numbers. Maps to java.math.BigDecimal on the JVM."]
[:db.type/uri "Value type for URIs. Maps to java.net.URI on the JVM."]
[:db.type/instant "Value type for instants in time. Stored internally as a number of milliseconds since midnight, January 1, 1970 UTC. Representation type will vary depending on the language you are using."]
[:db.type/float "Floating point value type. Same semantics as a Java float: single-precision 32-bit IEEE 754 floating point."]
[:db.type/string "Value type for strings."]
[:db.type/boolean "Boolean value type."]
[:db.type/bytes "Value type for small binaries. Maps to byte array on the JVM."]
[:db.type/ref "Value type for references. All references from one entity to another are through attributes with this value type."]
[:db.type/fn "Value type for database functions. See Javadoc for Peer.function."]
[:db.type/bigint "Value type for arbitrary precision integers. Maps to java.math.BigInteger on the JVM."]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment