ids

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToUUIDs

func ToUUIDs[K Kind](in []ID[K]) []uuid.UUID

ToUUIDs converts a slice of typed IDs into raw uuid.UUID values, for query arguments that encode UUID arrays.

Types

type AuthID

type AuthID = ID[AuthKind]

type AuthKind

type AuthKind struct{}

type ConsumerID

type ConsumerID = ID[ConsumerKind]

type ConsumerKind

type ConsumerKind struct{}

type GatewayID

type GatewayID = ID[GatewayKind]

type GatewayKind

type GatewayKind struct{}

type ID

type ID[K Kind] uuid.UUID

func From

func From[K Kind](u uuid.UUID) ID[K]

From wraps an existing uuid.UUID into a typed identifier.

func FromUUIDs

func FromUUIDs[K Kind](in []uuid.UUID) []ID[K]

FromUUIDs wraps a slice of raw uuid.UUID values into typed IDs.

func New

func New[K Kind]() ID[K]

New returns a random (v4) identifier of the requested kind.

func NewV7

func NewV7[K Kind]() (ID[K], error)

NewV7 returns a time-ordered (v7) identifier of the requested kind.

func Parse

func Parse[K Kind](s string) (ID[K], error)

Parse converts the canonical string form into a typed identifier.

func (ID[K]) IsNil

func (id ID[K]) IsNil() bool

IsNil reports whether the identifier is the zero/nil UUID.

func (ID[K]) MarshalText

func (id ID[K]) MarshalText() ([]byte, error)

func (*ID[K]) Scan

func (id *ID[K]) Scan(src any) error

Scan implements sql.Scanner so typed IDs can be scanned directly from rows.

func (ID[K]) String

func (id ID[K]) String() string

func (ID[K]) UUID

func (id ID[K]) UUID() uuid.UUID

UUID returns the underlying uuid.UUID, for use at infrastructure boundaries (SQL drivers, external clients) that speak raw UUIDs.

func (*ID[K]) UnmarshalText

func (id *ID[K]) UnmarshalText(text []byte) error

func (ID[K]) Value

func (id ID[K]) Value() (driver.Value, error)

Value implements driver.Valuer so typed IDs can be passed directly as query arguments.

type ModelID

type ModelID = ID[ModelKind]

type ModelKind

type ModelKind struct{}

type PolicyID

type PolicyID = ID[PolicyKind]

type PolicyKind

type PolicyKind struct{}

type ProviderID

type ProviderID = ID[ProviderKind]

type ProviderKind

type ProviderKind struct{}

type RegistryID

type RegistryID = ID[RegistryKind]

type RegistryKind

type RegistryKind struct{}

type RoleID

type RoleID = ID[RoleKind]

type RoleKind

type RoleKind struct{}

type VaultID

type VaultID = ID[VaultKind]

type VaultKind

type VaultKind struct{}

Jump to

Keyboard shortcuts

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