package ulid

import "git.sr.ht/~pingoo/stdx/ulid"

Index

Constants

const (
	Size       = 16
	StringSize = 26
)

Types

type ULID

type ULID [Size]byte

TODO

var (
	Nil ULID
)

func New

func New() ULID

func NewErr

func NewErr() (ULID, error)

func Parse

func Parse(input string) (ret ULID, err error)

func ParseBytes

func ParseBytes(input []byte) (ret ULID, err error)

func (ULID) Bytes

func (ulid ULID) Bytes() []byte

func (ULID) Equal

func (ulid ULID) Equal(other ULID) bool

func (ULID) MarshalBinary

func (ulid ULID) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (ULID) MarshalText

func (ulid ULID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*ULID) Scan

func (ulid *ULID) Scan(src interface{}) (err error)

TODO: improve Scan implements sql.Scanner so ULIDs can be read from databases transparently. Currently, database types that map to string and []byte are supported. Please consult database-specific driver documentation for matching types.

func (ULID) String

func (ulid ULID) String() string

String returns the string form of ulid

func (ULID) UUIDString

func (ulid ULID) UUIDString() string

UUIDString returns the UUID string form of ulid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

func (*ULID) UnmarshalText

func (ulid *ULID) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (ULID) Value

func (ulid ULID) Value() (driver.Value, error)

Value implements sql.Valuer so that ULIDs can be written to databases transparently. Currently, ULIDs map to strings. Please consult database-specific driver documentation for matching types.

Source Files

ulid.go

Version
v0.0.0-20240218134121-094174641f6e (latest)
Published
Feb 18, 2024
Platform
linux/amd64
Imports
7 packages
Last checked
4 months ago

Tools for package owners.