Documentation ¶
Overview ¶
Package uuid is a basic implementation of the version 4 spec of the univeral unique identifier.
Index ¶
- Constants
- func ParseExisting(uuid *UUID, corpus string) error
- type UUID
- func (uuid UUID) Compare(other UUID) int
- func (uuid UUID) Equal(other UUID) bool
- func (uuid UUID) Format(s fmt.State, verb rune)
- func (uuid UUID) IsV4() bool
- func (uuid UUID) IsZero() bool
- func (uuid UUID) Marshal() ([]byte, error)
- func (uuid UUID) MarshalJSON() ([]byte, error)
- func (uuid UUID) MarshalTo(data []byte) (n int, err error)
- func (uuid UUID) MarshalYAML() (interface{}, error)
- func (uuid *UUID) Scan(src interface{}) error
- func (uuid *UUID) Size() int
- func (uuid UUID) String() string
- func (uuid UUID) ToFullString() string
- func (uuid UUID) ToShortString() string
- func (uuid *UUID) Unmarshal(data []byte) error
- func (uuid *UUID) UnmarshalJSON(corpus []byte) error
- func (uuid *UUID) UnmarshalYAML(unmarshaler func(interface{}) error) error
- func (uuid UUID) Value() (driver.Value, error)
- func (uuid UUID) Version() byte
Constants ¶
const ( ErrParseInvalidUUIDInput = exception.Class("parse uuid: existing uuid is invalid") ErrParseEmpty = exception.Class("parse uuid: input is empty") ErrParseInvalidLength = exception.Class("parse uuid: input is an invalid length") ErrParseIllegalCharacter = exception.Class("parse uuid: illegal character") )
Error Classes
const (
ErrInvalidScanSource exception.Class = "uuid: invalid scan source"
)
ErrInvalidScanSource is an error returned by scan.
Variables ¶
This section is empty.
Functions ¶
func ParseExisting ¶
ParseExisting parses into an existing UUID.
Types ¶
type UUID ¶
type UUID []byte
UUID represents a unique identifier conforming to the RFC 4122 standard. UUIDs are a fixed 128bit (16 byte) binary blob.
func Parse ¶
Parse parses a uuidv4 from a given string. valid forms are: - {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
func (UUID) Format ¶
Format allows for conditional expansion in printf statements based on the token and flags used.
func (UUID) IsV4 ¶
IsV4 returns true iff uuid has version number 4, variant number 2, and length 16 bytes
func (UUID) MarshalJSON ¶
MarshalJSON marshals a uuid as json.
func (UUID) MarshalYAML ¶
MarshalYAML marshals a uuid as yaml.
func (UUID) ToFullString ¶
ToFullString returns a "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" hex representation of a uuid.
func (UUID) ToShortString ¶
ToShortString returns a hex representation of the uuid.
func (*UUID) UnmarshalJSON ¶
UnmarshalJSON unmarshals a uuid from json.
func (*UUID) UnmarshalYAML ¶
UnmarshalYAML unmarshals a uuid from yaml.