View add_at.clj
;; non-working add-at
(require '[boot.core :as core]
'[boot.tmpdir :as tmpd]
'[clojure.java.io :as io])
(deftask add-at
"Like sift :add-*, but lets you make a dest path in fileset"
[r rolekey ROLEKEY kw "rolekey"
s source SOURCE file "source path in project"
d dest DEST file "dest path in fileset"]
View gist:736cd82a51eb9ad24c65bfcac06f5101
(s/keys :req [::first-name
::last-name
::middle-initial])
(s/keys :req [::first-name
::last-name
::middle-initial]
:opt-un [::middle-name])
View log_size.clj
;; bin/run log_size.clj DB-URI t
;; Estimates the total in-memory size of all log entries from t to end of data.
;; Scans log from t to the end, so run against a backup instead of production if possible!
(require
'[clojure.edn :as edn]
'[clojure.pprint :as pp]
'[datomic.api :as d]
'[datomic.memory-size :as size])
View crosscheck_tx_instants.clj
;; bin/run crosscheck_tx_instants.clj DB-URI t
;; This program walks the log to find txInstants
;; and then finds the same instants in the indexes.
;; Scans log from t to the end, so run against a backup instead of production if possible!
(require
'[clojure.edn :as edn]
'[clojure.pprint :as pp]
'[datomic.api :as d])
View log_as.clj
;; bin/run log_as.clj DB-URI t attr
;; This program walks the log extracting datoms about a particular attribute.
;; Reveals domain data, but only about that one attribute.
;; Scans log from t to the end, so run against a backup instead of production if possible!
(require
'[clojure.edn :as edn]
'[clojure.pprint :as pp]
'[datomic.api :as d])
View log_ts.clj
;; This program walks the entire log extracting information about t
;; Does not reveal any domain data.
;; Scans entire log, so run against a backup instead of production if possible!
(require '[datomic.api :as d]
'[clojure.pprint :as pp])
(defn max-t
"Returns the maximum t mentioned in a collection of datoms"
[datoms]
(reduce
View entity-summary.clj
(require '[datomic.api :as d])
(defn entity-summary
"Returns a map with
:eavt vector of all eavt history datoms with eid
:log vector of all log entries containing those datoms"
[conn eid]
(let [log (d/log conn)
db (d/db conn)
hist (d/history db)
View interactive-query-dev.clj
(def zap (partial + 1))
(d/q '[:find ?b
:in ?a
:where [(user/zap ?a) ?b]]
1)
;; #{[2]}
(def zap (partial + 2))
View Nil Finder
(ns user)
(def app
"Intenal Helper"
(fnil conj []))
(defprotocol PathSeq
(path-seq* [form path] "Helper for path-seq"))
(extend-protocol PathSeq
View how-many-datoms.clj
(require
'[datomic.api :as d])
(defn how-many-datoms-did-tx-make?
"Return the number of datoms created by transaction at
time t, defaulting t to the most recent transaction."
([conn] (how-many-datoms-did-tx-make? conn (-> conn d/db d/basis-t)))
([conn t]
(some-> (d/log conn) (d/tx-range t nil) first :data count)))