id

package
v0.20.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Highest = "ZZZZZZZZZZZZZZZZZZZZZZZZZZ" // Highest is the highest possible ULID
	Lowest  = "00000000000000000000000000" // Lowest is the lowest possible ULID

)

Variables

This section is empty.

Functions

func NewRandomULID

func NewRandomULID() string

NewRandomULID returns a new ULID string using a random time in an ~80 year range around the current datetime.

func NewULID

func NewULID() string

NewULID returns a new ULID string using the current time.

func NewULIDFromTime

func NewULIDFromTime(t time.Time) string

NewULIDFromTime returns a new ULID string using given time, or from current time on any error.

func TimeFromULID

func TimeFromULID(id string) (time.Time, error)

TimeFromULID parses a ULID string and returns the encoded time.Time{}, or error with caller prefix.

func ValidatePage added in v0.20.0

func ValidatePage(page *paging.Page)

ValidatePage ensures that passed page has valid paging values for the current defined ordering. That is, it ensures a valid page *cursor* value, using id.Highest or id.Lowest where appropriate when none given.

Types

type ULID

type ULID string

ULID represents a Universally Unique Lexicographically Sortable Identifier of 26 characters. See https://github.com/oklog/ulid

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL