Documentation ¶
Overview ¶
Package provides functions to generate and parse readable global identifiers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidIdentifier = errors.Base("invalid identifier")
Functions ¶
Types ¶
type Identifier ¶
type Identifier [16]byte
func FromData ¶
func FromData(data [16]byte) Identifier
FromData returns 16 bytes data encoded as an Identifier.
func FromReader ¶
func FromReader(r io.Reader) (Identifier, errors.E)
FromReader returns a new random identifier using r as a source of randomness.
func FromString ¶
func FromString(data string) (Identifier, errors.E)
FromString parses a string-encoded identifier in base 58 encoding into a corresponding Identifier value.
func FromUUID ¶
func FromUUID(data uuid.UUID) Identifier
FromUUID returns the UUID encoded as an Identifier.
func MustFromReader ¶
func MustFromReader(r io.Reader) Identifier
MustFromReader is the same as FromReader but panics on an error.
func MustFromString ¶
func MustFromString(data string) Identifier
MustFromString is the same as FromString but panics on an error.
func (Identifier) MarshalText ¶
func (i Identifier) MarshalText() ([]byte, error)
func (Identifier) String ¶
func (i Identifier) String() string
String encodes Identifier value into a string using base 58 encoding.
func (*Identifier) UnmarshalText ¶
func (i *Identifier) UnmarshalText(text []byte) error
Click to show internal directories.
Click to hide internal directories.