uuid

package
v0.0.0-...-bc49051 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrParseInvalidUUIDInput = "parse uuid: existing uuid is invalid"
	ErrParseInvalidLength    = "parse uuid: input is an invalid length"
	ErrParseIllegalCharacter = "parse uuid: illegal character"
)

Error Classes

View Source
const (
	ErrInvalidScanSource = "uuid; invalid scan source"
)

ErrInvalidScanSource is an error returned by scan.

Variables

This section is empty.

Functions

func ParseInto

func ParseInto(uuid *UUID, corpus string) error

ParseInto parses into an existing UUID.

Types

type UUID

type UUID [16]byte

UUID represents a unique identifier conforming to the RFC 4122 standard. UUIDs are a fixed 128bit (16 byte) binary blob.

func MustParse

func MustParse(corpus string) (uuid UUID)

MustParse parses a uuid and will panic if there is an error.

func Parse

func Parse(corpus string) (uuid UUID, err error)

Parse parses a uuidv4 from a given string. valid forms are: - {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

func V4

func V4() UUID

V4 Create a new UUID version 4.

func (UUID) Compare

func (uuid UUID) Compare(other UUID) int

Compare returns a comparison between the two uuids.

func (UUID) Equal

func (uuid UUID) Equal(other UUID) bool

Equal returns if a uuid is equal to another uuid.

func (UUID) Format

func (uuid UUID) Format(s fmt.State, verb rune)

Format allows for conditional expansion in printf statements based on the token and flags used.

func (UUID) IsV4

func (uuid UUID) IsV4() bool

IsV4 returns true iff uuid has version number 4, variant number 2, and length 16 bytes

func (UUID) IsZero

func (uuid UUID) IsZero() bool

IsZero returns if the uuid is unset.

func (UUID) Marshal

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

Marshal implements bytes marshal.

func (UUID) MarshalJSON

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

MarshalJSON marshals a uuid as json.

func (UUID) MarshalTo

func (uuid UUID) MarshalTo(data []byte) (n int, err error)

MarshalTo marshals the uuid to a buffer.

func (UUID) MarshalYAML

func (uuid UUID) MarshalYAML() (interface{}, error)

MarshalYAML marshals a uuid as yaml.

func (*UUID) Scan

func (uuid *UUID) Scan(src interface{}) error

Scan scans a uuid from a db value.

func (*UUID) Set

func (uuid *UUID) Set(src interface{}) error

Set accepts a src and populates the value based on it.

This is similar to Scan but used directly by pgx.

func (UUID) ShortString

func (uuid UUID) ShortString() string

ShortString returns the first 8 bytes of the uuid as a hex string.

func (*UUID) Size

func (uuid *UUID) Size() int

Size returns the size of the uuid.

func (UUID) String

func (uuid UUID) String() string

String returns the uuid as a hex string.

func (*UUID) Unmarshal

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

Unmarshal implements bytes unmarshal.

func (*UUID) UnmarshalJSON

func (uuid *UUID) UnmarshalJSON(corpus []byte) error

UnmarshalJSON unmarshals a uuid from json.

func (*UUID) UnmarshalYAML

func (uuid *UUID) UnmarshalYAML(unmarshaler func(interface{}) error) error

UnmarshalYAML unmarshals a uuid from yaml.

func (UUID) Value

func (uuid UUID) Value() (driver.Value, error)

Value returns a sql driver value.

func (UUID) Version

func (uuid UUID) Version() byte

Version returns the version byte of a uuid.

Jump to

Keyboard shortcuts

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