Public Vars

Back

uuid? (clj)

(source)

function

(uuid? x)
Return true if x is a java.util.UUID

Examples

typedclojure/typedclojure
(ns ^:no-doc typed.ann.clojure
  "Type annotations for the base Clojure distribution."
  #?(:cljs (:require-macros [typed.ann-macros.clojure :as macros]))
  (:require [clojure.core :as cc]
            [typed.clojure :as t]
            #?(:clj [typed.ann-macros.clojure :as macros])
            #?(:clj typed.ann.clojure.jvm) ;; jvm annotations
            #?(:clj clojure.core.typed))
  #?(:clj
     (:import (clojure.lang PersistentHashSet PersistentList
                            APersistentMap #_IPersistentCollection
                            #_ITransientSet
                            IRef)
              (java.util Comparator Collection))))

cc/seqable? (t/Pred t/AnySeqable)
cc/indexed? (t/Pred (t/Indexed t/Any))
cc/inst-ms [:-> t/Int]
cc/inst? (t/Pred cc/Inst)
cc/uuid? (t/Pred t/UUID)
cc/random-uuid [:-> t/UUID]
cc/parse-uuid [t/Str :-> (t/Option t/UUID)]
cc/uri? (t/Pred t/URI)
cc/tagged-literal? (t/Pred clojure.lang.TaggedLiteral)
cc/reader-conditional? (t/Pred clojure.lang.ReaderConditional)
replikativ/konserve
(ns konserve.node-filestore-test
  (:require [clojure.core.async :refer [go promise-chan <! put! chan timeout to-chan!]]
            [cljs-node-io.fs :as fs]
            [cljs-node-io.core :as io]
            [cljs.test :refer-macros [deftest is testing async use-fixtures]]
            [fress.api :as fress]
            [konserve.core :as k]
            [konserve.impl.defaults :as d]
            [konserve.node-filestore :as filestore :refer [connect-fs-store]]
            [konserve.protocols :as p]
            [konserve.tests.cache :as ct]
            [konserve.tests.encryptor :as et]
            [konserve.tests.gc :as gct]
            [konserve.tests.serializers :as st]))

(deftest append-store-async-test
  (async done
         (go
           (let [opts {:sync? false}
                 store (<! (connect-fs-store store-path :opts opts))]
             (is (uuid? (second (<! (k/append store :foolog {:bar 42} opts)))))
             (is (uuid? (second (<! (k/append store :foolog {:bar 43} opts)))))
             (is (= '({:bar 42} {:bar 43}) (<! (k/log store :foolog opts))))
             (is (=  [{:bar 42} {:bar 43}] (<! (k/reduce-log store :foolog conj [] opts))))
             (let [{:keys [key type last-write]} (<! (k/get-meta store :foolog :not-found opts))]
               (is (= key :foolog))
               (is (= type :append-log))
               (is (inst? last-write)))
             (done)))))
replikativ/konserve
(ns konserve.indexeddb-test
  (:require [clojure.core.async :refer [go <! put! take! promise-chan]]
            [cljs.test :refer-macros [deftest is testing async]]
            [konserve.cache :as kc]
            [konserve.core :as k]
            [konserve.indexeddb :as idb]
            [konserve.protocols :as p]
            [konserve.tests.cache :as ct]
            [konserve.tests.encryptor :as et]
            [konserve.tests.gc :as gct]
            [konserve.tests.serializers :as st])
  (:import [goog userAgent]))

(deftest ^:browser append-store-async-test
  (async done
         (go
           (let [db-name "append-test"
                 _ (<! (idb/delete-idb db-name))
                 opts {:sync? false}
                 store (<! (idb/connect-idb-store db-name :opts opts))]
             (is (uuid? (second (<! (k/append store :foolog {:bar 42} opts)))))
             (is (uuid? (second (<! (k/append store :foolog {:bar 43} opts)))))
             (is (= '({:bar 42} {:bar 43}) (<! (k/log store :foolog opts))))
             (is (=  [{:bar 42} {:bar 43}] (<! (k/reduce-log store :foolog conj [] opts))))
             (let [{:keys [key type last-write]} (<! (k/get-meta store :foolog :not-found opts))]
               (is (= key :foolog))
               (is (= type :append-log))
               (is (inst? last-write)))
             (<! (.close (:backing store)))
             (<! (idb/delete-idb db-name))
             (done)))))