keys

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyUID    = errors.New("empty uid id")
	ErrEmptyName   = errors.New("empty name id")
	ErrBadEncoding = errors.New("bad id encoding")
	ErrBadTag      = errors.New("unknown id tag")
	ErrBadUIDLen   = errors.New("uuid payload must be 16 bytes")
	ErrBadPrefix   = errors.New("bad or unknown prefix")
	ErrBadUUIDLen  = errors.New("uuid payload must be 16 bytes")
)

Functions

This section is empty.

Types

type ID

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

func Decode

func Decode(b []byte) (ID, error)

func FromUIDOrName

func FromUIDOrName(uid, name string) (ID, error)

FromUIDOrName creates a ID from the provded strings. Prioritizes UIDs

func Name

func Name(s string) (ID, error)

func ParseBytes

func ParseBytes(prefix, fullKey []byte) (ID, error)

ParseBytes lets you decode ID from a full key (useful in iterators/scans).

func ParseStr

func ParseStr(in string) (ID, error)

ParseStr returns a UID from a string. Prioritizes UUID's

func UUID

func UUID(u uuid.UUID) (ID, error)

func (ID) AsUUID

func (id ID) AsUUID() (uuid.UUID, error)

AsUUID returns the UUID if tag is TagUID.

func (ID) Encode

func (id ID) Encode() []byte

func (ID) EncodePrefixed

func (id ID) EncodePrefixed(prefix []byte) []byte

func (ID) NameStr

func (id ID) NameStr() string

func (ID) Raw

func (id ID) Raw() []byte

func (ID) String

func (id ID) String() string

func (ID) Tag

func (id ID) Tag() Tag

func (ID) UUIDStr

func (id ID) UUIDStr() string

type Tag

type Tag byte
const (
	UUIDLen     = 16 // Bytes
	TagUID  Tag = 0x01
	TagName Tag = 0x02
)

Jump to

Keyboard shortcuts

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