o
odinpkg.dev
packages / library / odin-ulid

odin-ulid

85eb9a2library

Odin implementation for ULIDs

MIT · updated 3 years ago

Universally Unique Lexicographically Sortable Identifier (ULID)

An Odin implementation for ULID

Please check the ULID Specification to learn more


Examples:

Basic usage

import "ulid"

ulid, err := ulid.generate_ulid()
if err != .None {
	// Handle Error
}
...

If you need a monotonic generation(in case two ulids might be generated in the same millisecond)

import "ulid"

ulid, err := ulid.generate_monotonic_ulid()
if err != .None {
	// Handle Error
}
...

In case you need to decode an ulid string into its u128be value

import "ulid"

using ulid
ulid, _ := generate_ulid()
value, err := decode(ulid)
if err != .None {
	// Handle Error
}
...