All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
parse now returns platform-native UUID objects instead of byte arrays
The :uuid field in the result map is now a UUID object (java.util.UUID on JVM, cljs.core/UUID in ClojureScript) instead of a byte array.
;; v0.1.x (old)
(:uuid (typeid/parse "user_01h5fskfsk4fpeqwnsyz5hj55t"))
;;=> #object["[B" ... (byte array)]
;; v0.2.0 (new)
(:uuid (typeid/parse "user_01h5fskfsk4fpeqwnsyz5hj55t"))
;;=> #uuid "018c3f9e-9e4e-7a8a-8b2a-7e8e9e4e7a8a"
Why this change?
=strcreate accepts UUIDs, parse returns UUIDsMigration:
typeid.impl.uuid/uuid->bytes:
(require '[typeid.impl.uuid :as uuid])
(let [{:keys [uuid]} (typeid/parse "user_...")]
(uuid/uuid->bytes uuid)) ;; Get bytes if needed
typeid.impl.uuid/bytes->uuid - Convert 16-byte array to platform-native UUIDtypeid.impl.uuid/uuid->bytes - Convert platform-native UUID to 16-byte arraybytes->uuid: < 500ns per operation (new function)uuid->bytes: < 500ns per operation (new function)parse: ~500ns additional overhead for UUID conversion (now < 3μs total)Documentation: Improved docstring formatting for better cljdoc rendering
typeid.core, typeid.validation, typeid.codecBuild tooling: Removed Codox in favor of automatic cljdoc generation
bb docs tasks and :codox aliasInitial release.
Core API (typeid.core):
create - Generate new TypeIDs with optional prefixes, or create from existing UUIDsparse - Parse TypeID strings into componentsexplain - Validate TypeID and get detailed error informationCodec API (typeid.codec):
encode - Convert UUID bytes + prefix to TypeID stringdecode - Extract UUID bytes from TypeID stringuuid->hex / hex->uuid - UUID format conversion helpersCross-platform support: Identical API for Clojure JVM and ClojureScript
System.currentTimeMillis() and SecureRandomjs/Date.now() and crypto.getRandomValues()Comprehensive validation:
:type, :message, :input, :expected, :actualTesting infrastructure:
80% code coverage (100% for critical paths)
Documentation:
Build and tooling:
Benchmarks measured with Criterium on JDK 17:
create: < 2μs per operationparse: < 2μs per operationencode/decode: < 1μs per operationvalidate-prefix: < 500ns per operationCan you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |