Implementation of ULIDs which are similar to random UUIDs except they are also sortable.
Go to file
Wisellama 8a73d8c2ea Add license and readme 2024-03-08 23:42:35 -08:00
crockford32 Add crockford decoding 2024-02-21 01:07:04 -08:00
examples Add examples 2024-02-20 23:04:26 -08:00
.gitignore It works 2024-02-17 20:21:36 -08:00
LICENSE.md Add license and readme 2024-03-08 23:42:35 -08:00
README.md Add license and readme 2024-03-08 23:42:35 -08:00
go.mod Re-organize code into an actual library 2024-02-20 22:15:17 -08:00
go.sum Re-organize code into an actual library 2024-02-20 22:15:17 -08:00
ulid.go Add crockford decoding 2024-02-21 01:07:04 -08:00
ulid_test.go Add crockford decoding 2024-02-21 01:07:04 -08:00

README.md

ULID

go get git.wisellama.rocks/Wisellama/ulid@v0.0.1

ULIDs are universally unique lexico-graphically sortable identifiers. They fit in the same 128-bits as a UUID, except that instead of being pure random or using some hardware information, they tag on a timestamp on the front. This makes them random but sortable which is useful when using them for database IDs. Databases can pre-load chunks of IDs that it assumes will be used. Fully random IDs would break this caching functionality, but sortable random IDs will keep the performance benefits.

This is Wisellama's implementation of a ULID library following the spec: https://git.wisellama.rocks/Mirrors/ulid-spec

I was inspired by oklog's ULID library, and I used it to verify my implementation was working correctly. I use this library in production at work, so I highly recommend it. https://github.com/oklog/ulid

I did not implement the full spec, and I'm sure I'm missing features that are available in the oklog repo. However, I wanted to implement ULIDs myself to support the features I use regularly. I don't like adding unnecessary dependencies, so if there's something easy enough that I can implement myself, I will most likely attempt to do so.

See the examples directory for usage.