Documentation ¶
Overview ¶
Package ulid is a lightweight wrapper around the github.com/oklog/ulid package that provides some common functionality (like checking if a ULID is null or is zero) as well as a process-global, cryptographically random, monotonic, and thread-safe ulid generation mechanism that can be used from external packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrUnknownType = errors.New("cannot parse input: unknown type")
)
var Null = ulid.ULID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
Null ULID pre-allocated for easier checking.
Functions ¶
func IsZero ¶
func IsZero(uid ulid.ULID) bool
Determines if the specified uid is the Null or zero-valued ULID. Useful for determining if a ULID has been passed into a method or is valid.
func MustParse ¶
func MustParse(uid any) (id ulid.ULID)
MustParse parses the ULID but panics on errors.
func New ¶
func New() ulid.ULID
New creates a new montonically increasing ULID in a threadsafe manner using a cryptographically random source of entropy for security (e.g. to ensure that an attacker cannot guess the next ULID to be generated). If the ULID cannot be generated this method panics rather than returning an error.
Types ¶
This section is empty.