Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 482 Bytes

File metadata and controls

23 lines (15 loc) · 482 Bytes

prefixed

Prefixed, sortable, base32 encoded UUID v7's.

Inspired by Stripe entity ID's and the typeid specification.

Usage

import "github.com/lsl/prefixed"

// Create a prefixed ID
id := prefixed.New("user") // "user_abc123def456..."

// Parse an ID
prefix, encodedUUID, err := prefixed.Parse(id)

// Decode an ID
prefix, decodedUUID, err := prefixed.Decode(id)

// Validate an ID
ok := prefixed.Validate(id)