Skip to content

Add compact ID generator and tests

Choose a tag to compare

@DarkAngel7 DarkAngel7 released this 09 Jul 08:02
· 1 commit to master since this release

Introduce a compact snowflake-style ID type and generator optimized for short numeric IDs. Adds CompactID and CompactNode (compact.go) with a 32-bit seconds timestamp, 8-bit node, and 13-bit sequence (up to 8192 IDs/sec/node). Implements generation (lock-free CAS), assembly, string/parse helpers, and JSON marshal/unmarshal. Includes comprehensive tests and benchmarks (compact_test.go) covering node creation, duplicates, concurrency, sequence rollover, JSON, and parsing. Updates README with Compact ID docs and adds .gitignore entries for /.cursor and /.idea.

Full Changelog: v0.3.1...v0.3.2