ids

package
v2.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllToString

func AllToString(ids []Id) []string

func Compare

func Compare(id Id, other Id) int

func IsEmpty

func IsEmpty(id Id) bool

func IsNotEmpty

func IsNotEmpty(id Id) bool

func ToBytes

func ToBytes(id Id) []byte

Types

type Id

type Id = uuid.UUID

Id is a generic identifier for entities

func Empty

func Empty() Id

func FromBytes

func FromBytes(bytes []byte) (Id, error)

func New

func New() Id

func NewID

func NewID(values ...any) Id

NewID computes a UUID string hashing the provided values

func OrDefault

func OrDefault(id Id, defaultId Id) Id

OrDefault returns the defaultId if id is empty, otherwise returns id

func OrNew

func OrNew(id Id) Id

OrNew returns a new Id if id is empty, otherwise returns id

func ParseID

func ParseID(id string) (Id, error)

func SelfOrNew

func SelfOrNew(id Id) Id

SelfOrNew returns a new Id if id is empty, otherwise returns id Deprecated: use OrNew instead

Jump to

Keyboard shortcuts

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