# oklog/ulid

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/oklog-ulid).**

5,040 stars · 182 forks · Go · Apache-2.0

## Links

- GitHub: https://github.com/oklog/ulid
- awesome-repositories: https://awesome-repositories.com/repository/oklog-ulid.md

## Description

This project is an implementation of the ULID standard in the Go programming language. It provides tools for generating universally unique, lexicographically sortable identifiers that combine millisecond timestamps with random data.

The library ensures that identifiers maintain chronological order through alphabetical sorting. It includes a monotonic generator to guarantee that multiple identifiers created within the same millisecond are produced in a strictly increasing sequence.

The project covers unique identifier generation and database primary key optimization. It also provides a command-line interface for generating new identifiers and extracting timestamp information from existing identity strings.

## Tags

### Programming Languages & Runtimes

- [ULID Implementations](https://awesome-repositories.com/f/programming-languages-runtimes/ulid-implementations.md) — Implements the ULID standard specifically for the Go programming language.

### Data & Databases

- [Lexicographical Sorting](https://awesome-repositories.com/f/data-databases/custom-key-ordering/lexicographical-sorting.md) — Ensures identifiers are byte-sorted lexicographically, allowing them to be sorted alphabetically by creation time.
- [Monotonic Identifier Generation](https://awesome-repositories.com/f/data-databases/monotonic-identifier-generation.md) — Guarantees that identifiers generated within the same millisecond are produced in a strictly increasing sequence.
- [Unique Identifier Generators](https://awesome-repositories.com/f/data-databases/unique-identifier-generators.md) — Provides utilities for creating compact and unique strings combining timestamps and randomness for use as primary keys.
- [Distributed Primary Key Generation](https://awesome-repositories.com/f/data-databases/entity-modeling/primary-keys/distributed-primary-key-generation.md) — Provides time-ordered unique identifiers designed to optimize indexing and reduce fragmentation in database primary keys.

### Security & Cryptography

- [Entropy-Based Collision Prevention](https://awesome-repositories.com/f/security-cryptography/entropy-based-collision-prevention.md) — Combines random entropy with timestamps to ensure global uniqueness and prevent collisions during high-frequency generation.

### Software Engineering & Architecture

- [Millisecond Clock Sequences](https://awesome-repositories.com/f/software-engineering-architecture/causal-ordering-timestamps/millisecond-clock-sequences.md) — Implements sequence numbers that reset per millisecond to maintain strict chronological order for identifiers.
- [Crockford Base32 Encodings](https://awesome-repositories.com/f/software-engineering-architecture/base64-encoding-and-decoding/binary-to-text-encodings/crockford-base32-encodings.md) — Provides a case-insensitive, human-readable Base32 encoding that excludes ambiguous characters for easier data entry.
- [Identifier Bit-Packing](https://awesome-repositories.com/f/software-engineering-architecture/memory-layout-optimizations/bit-packed-storage/identifier-bit-packing.md) — Implements techniques for packing timestamps and random data into a structured unique identifier using bitwise shifts.

### Part of an Awesome List

- [Unique Identifiers](https://awesome-repositories.com/f/awesome-lists/data/unique-identifiers.md) — Implementation of Universally Unique Lexicographically Sortable Identifiers.
- [Unique ID Generation](https://awesome-repositories.com/f/awesome-lists/devtools/unique-id-generation.md) — ULID implementation.
