diff options
| author | Ivar Refsdal <ivar.refsdal@nsd.no> | 2021-09-04 13:23:07 +0200 |
|---|---|---|
| committer | Ivar Refsdal <ivar.refsdal@nsd.no> | 2021-09-14 12:52:42 +0200 |
| commit | ea40c5dbc2b47d6fd2a23236828dc9e4ab1f77dc (patch) | |
| tree | 38db9a13c41576dd39a18ec4f4b2d498322a30c2 /src/com/github/ivarref/yoltq/ext_sys.clj | |
| download | fiinha-ea40c5dbc2b47d6fd2a23236828dc9e4ab1f77dc.tar.gz fiinha-ea40c5dbc2b47d6fd2a23236828dc9e4ab1f77dc.tar.xz | |
Initial commit
Add release script
Release 0.1.3
Use com.github.ivarref.yoltq namespace
Use com.github.ivarref.yoltq namespace
Diffstat (limited to 'src/com/github/ivarref/yoltq/ext_sys.clj')
| -rw-r--r-- | src/com/github/ivarref/yoltq/ext_sys.clj | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/com/github/ivarref/yoltq/ext_sys.clj b/src/com/github/ivarref/yoltq/ext_sys.clj new file mode 100644 index 0000000..3480475 --- /dev/null +++ b/src/com/github/ivarref/yoltq/ext_sys.clj @@ -0,0 +1,26 @@ +(ns com.github.ivarref.yoltq.ext-sys + (:require [datomic.api :as d]) + (:import (java.util UUID))) + + +(def ^:dynamic *now-ns-atom* nil) +(def ^:dynamic *squuid-atom* nil) +(def ^:dynamic *random-atom* nil) + + +(defn now-ns [] + (if *now-ns-atom* + @*now-ns-atom* + (System/nanoTime))) + + +(defn squuid [] + (if *squuid-atom* + (UUID/fromString (str "00000000-0000-0000-0000-" (format "%012d" (swap! *squuid-atom* inc)))) + (d/squuid))) + + +(defn random-uuid [] + (if *random-atom* + (UUID/fromString (str "00000000-0000-0000-0000-" (format "%012d" (swap! *random-atom* inc)))) + (UUID/randomUUID)))
\ No newline at end of file |
