common

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: AGPL-3.0 Imports: 11 Imported by: 6

README

common

common go utilities

Documentation

Index

Constants

View Source
const (
	UlidByteSize   = 16
	UlidStringSize = 26
)

Variables

View Source
var (
	ErrUnknown      = errors.New("unknown")
	ErrNotFound     = errors.New("not found")
	ErrConflict     = errors.New("conflict")
	ErrBadInput     = errors.New("bad input")
	ErrNotAllowed   = errors.New("not allowed")
	ErrInvalidState = errors.New("invalid state")
)

Functions

This section is empty.

Types

type Set

type Set[A comparable] interface {
	Has(a A) bool
	Add(a A)
	AddAll(a ...A)
	Remove(a A)
	Count() int
	Values() []A
}

func NewSet

func NewSet[A comparable]() Set[A]

type Ulid added in v1.2.0

type Ulid interface {
	TimeBytes() []byte
	EntropyBytes() []byte
	Bytes() []byte
	String() string
	Time() *time.Time
	BitString() string
	Equals(other Ulid) bool
	MarshalJSON() ([]byte, error)
	UnmarshalJSON([]byte) error
}

func MustUlidFromString added in v1.2.0

func MustUlidFromString(encoded string) Ulid

func NewMonotonicUlid added in v1.2.0

func NewMonotonicUlid() Ulid

func NewUlid added in v1.2.0

func NewUlid() Ulid

func NewZeroUlid added in v1.2.0

func NewZeroUlid() Ulid

func UlidFromBytes added in v1.2.0

func UlidFromBytes(bytes []byte) (Ulid, error)

func UlidFromString added in v1.2.0

func UlidFromString(encoded string) (Ulid, error)

func UlidFromTime added in v1.2.0

func UlidFromTime(time time.Time) Ulid

Jump to

Keyboard shortcuts

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