Created
May 25, 2015 16:00
-
-
Save arohner/d7a6bb057824c224b5b3 to your computer and use it in GitHub Desktop.
Revisions
-
arohner created this gist
May 25, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ ;;; Extremely incomplete type annotations for Datomic. (ns foo.util.type.datomic (:require [clojure.core.typed :as t] [datomic.api :as d]) (:import (datomic Connection Database) (datomic.db DbId) (java.util Date UUID))) (t/ann ^:no-check datomic.api/tempid [t/Keyword -> datomic.db.DbId]) (t/defalias TxVal (t/U DbId t/AnyInteger String Boolean BigInteger Double BigDecimal Date UUID (Array byte))) (t/defalias TxAttr t/Keyword) (t/defalias TxVec (t/HVec [t/Keyword TxAttr TxVal])) ;; [:db/add e a v] (t/defalias TxMap (t/Map TxAttr TxVal)) (t/defalias TxDatom (t/U TxVec TxMap)) (t/defalias TxData (t/Vec TxDatom)) (t/ann ^:no-check datomic.api/db [Connection -> Database]) (t/defalias TxResult (t/HMap :mandatory {})) (t/ann ^:no-check datomic.api/transact [Connection TxData -> (t/Future TxResult)]) (t/defalias PullPattern (t/Vec t/Any)) (t/ann ^:no-check datomic.api/pull [Database PullPattern Long -> (t/Map TxAttr TxVal)]) (t/defalias Query (t/Vec t/Any)) (t/ann ^:no-check datomic.api/q [Query Database TxVal * -> t/Any])