typeid

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: MIT Imports: 4 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetUUIDFactory

func SetUUIDFactory(f *UUIDFactory)

Types

type TypeID

type TypeID interface {
	TypeName() string
	Value() string
	String() string
}

func Must

func Must(id TypeID, err error) TypeID

type UUID

type UUID struct {
	// contains filtered or unexported fields
}

A UUID is a TypeID with a UUID value.

func FromUUID

func FromUUID(typ string, id uuid.UUID) UUID

func NewUUID

func NewUUID(typ string) (UUID, error)

func ParseUUID

func ParseUUID(tid string) (UUID, error)

func (UUID) IsEmpty added in v0.1.9

func (id UUID) IsEmpty() bool

func (UUID) MarshalBinary

func (id UUID) MarshalBinary() ([]byte, error)

func (UUID) MarshalJSON

func (id UUID) MarshalJSON() ([]byte, error)

func (UUID) MarshalText

func (id UUID) MarshalText() ([]byte, error)

func (UUID) String

func (id UUID) String() string

func (UUID) TypeName

func (id UUID) TypeName() string

func (UUID) UUID

func (id UUID) UUID() uuid.UUID

func (*UUID) UnmarshalBinary

func (id *UUID) UnmarshalBinary(data []byte) error

func (*UUID) UnmarshalJSON

func (id *UUID) UnmarshalJSON(data []byte) error

func (*UUID) UnmarshalText

func (id *UUID) UnmarshalText(data []byte) error

func (UUID) Value

func (id UUID) Value() string

type UUIDFactory

type UUIDFactory struct {
	// contains filtered or unexported fields
}

UUIDFactory is a TypeID parser that generates and parses TypeIDs with UUIDs as values.

func NewUUIDFactory

func NewUUIDFactory(opts ...UUIDParserOption) *UUIDFactory

func (*UUIDFactory) From

func (p *UUIDFactory) From(typ string, id uuid.UUID) UUID

func (*UUIDFactory) New

func (p *UUIDFactory) New(typ string) (UUID, error)

func (*UUIDFactory) Parse

func (p *UUIDFactory) Parse(tid string) (UUID, error)

type UUIDParserOption

type UUIDParserOption func(*UUIDFactory)

func WithUUIDGenerator

func WithUUIDGenerator(fn func() (uuid.UUID, error)) UUIDParserOption

func WithUUIDParser

func WithUUIDParser(fn func(string) (uuid.UUID, error)) UUIDParserOption

func WithUUIDSeparator

func WithUUIDSeparator(chars string) UUIDParserOption

Jump to

Keyboard shortcuts

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