NULID/README.md

26 lines
660 B
Markdown
Raw Permalink Normal View History

2023-09-02 00:04:47 +00:00
# NULID
This is an implementation of the [ULID](https://github.com/ulid/spec)
spec in Nim! This also supports the JS backend for ULID generation!
2023-09-02 00:04:47 +00:00
This supports [`jsony`](https://github.com/treeform/jsony) and
[`debby`](https://github.com/treeform/debby) out of the box too!
Random fun fact: I coded the initial code for ULID generation on my phone
via Termux!
## Compile Flags
`-d:nulidInsecureRandom`: Uses `std/random` instead of `std/sysrand`.
`-d:nulidNoLocks`: Disables any usage of locks within the program.
The JS backend automatically defines `-d:nulidNoLocks`.
2023-09-02 00:04:47 +00:00
## Usage
```nim
let gen = initUlidGenerator()
let ulid = gen.ulid()
2023-09-02 00:04:47 +00:00
echo ulid
2023-09-02 00:04:47 +00:00
```