id

package
v0.0.0-...-34ec42c Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: MIT Imports: 4 Imported by: 2

Documentation

Overview

Package id contains the different types of IDs in the system for entities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyIdToBytes

func KeyIdToBytes(id KeyID) []byte

KeyIdToBytes converts a key ID into a slice of Bytes

func KeyIdToString

func KeyIdToString(keyId KeyID) string

KeyIdToString returns the string representation of the Key

func UUIDToBytes

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

UUIDToBytes converts an ID into a slice of Bytes

func UUIDToString

func UUIDToString(id UUID) string

UUIDToString returns the string representation of the ID

func XidToBytes

func XidToBytes(id XID) []byte

XidToBytes converts an ID into a slice of Bytes

func XidToString

func XidToString(id XID) string

XidToString returns the string representation of the ID

Types

type KeyID

type KeyID = ksuid.KSUID

KeyID is a unique key useful for entities that allows sorting

func BytesToKeyID

func BytesToKeyID(keyBytes []byte) (KeyID, error)

BytesToKeyID parses a slice of bytes to an ID

func NewKeyID

func NewKeyID() KeyID

NewKeyId creates a new Key ID which is a wrapper around KSUID

func StringToKeyID

func StringToKeyID(idString string) (KeyID, error)

StringToKeyID parses a string into an ID

type UUID

type UUID = uuid.UUID

func BytesToUUID

func BytesToUUID(idBytes []byte) (UUID, error)

BytesToUUID parses a slice of bytes to an ID

func NewUUID

func NewUUID() UUID

NewUUID generates a new ID

func StringToUUID

func StringToUUID(idString string) (UUID, error)

StringToIdentifier parses a string into an ID

type XID

type XID = xid.ID

func BytesToXid

func BytesToXid(idString []byte) (XID, error)

BytesToXid parses a slice of bytes to an ID

func NewXid

func NewXid() XID

NewXid generates a new ID

func StringToXid

func StringToXid(idString string) (XID, error)

StringToXid parses a string into an ID

Jump to

Keyboard shortcuts

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