uuid

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: ISC Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UUID

type UUID [16]byte
var (
	Nil UUID

	ErrInvalidFormat = errors.New("invalid format")
)

func FromBytes

func FromBytes(b []byte) (UUID, error)

FromBytes creates a new UUID from a byte slice. Returns an error if the slice does not have a length of 16. The bytes are copied from the slice.

func NewV4

func NewV4() (UUID, error)

func NewV7

func NewV7() (UUID, error)

func Parse

func Parse(s string) (UUID, error)

Parse decodes s into a UUID or returns an error if it cannot be parsed.

func ParseBytes

func ParseBytes(b []byte) (UUID, error)

ParseBytes is like Parse, except it parses a byte slice instead of a string.

func (UUID) MarshalBinary

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

MarshalBinary implements encoding.BinaryUnmarshaler.

func (UUID) MarshalText

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

MarshalText implements encoding.TextUnmarshaler.

func (UUID) String

func (uuid UUID) String() string

String implements fmt.Stringer.

func (UUID) Timestamp

func (uuid UUID) Timestamp() time.Time

Timestamp returns the timestamp extracted from a UUID v7.

func (*UUID) UnmarshalBinary

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

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (*UUID) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (UUID) Version

func (uuid UUID) Version() Version

Version returns the version of uuid.

type UUIDs

type UUIDs []UUID

func (UUIDs) String

func (uuids UUIDs) String() []string

String implements fmt.Stringer.

type Version

type Version byte

func (Version) String

func (v Version) String() string

String implements fmt.Stringer.

Jump to

Keyboard shortcuts

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