Documentation ¶
Overview ¶
Package uuid implements UUID v4 based on RFC4122.
Index ¶
- Variables
- func SortAscending(uuids []UUID)
- type NullUUID
- type UUID
- func (uuid UUID) Bytes() []byte
- func (uuid UUID) Compare(other UUID) int
- func (uuid *UUID) DecodeSpanner(val any) (err error)
- func (uuid UUID) EncodeSpanner() (any, error)
- func (uuid UUID) IsZero() bool
- func (uuid UUID) Less(other UUID) bool
- func (uuid UUID) Marshal() ([]byte, error)
- func (uuid UUID) MarshalJSON() ([]byte, error)
- func (uuid UUID) MarshalText() ([]byte, error)
- func (uuid *UUID) MarshalTo(data []byte) (n int, err error)
- func (uuid *UUID) Scan(value interface{}) error
- func (uuid UUID) Size() int
- func (uuid UUID) String() string
- func (uuid *UUID) Unmarshal(data []byte) error
- func (uuid *UUID) UnmarshalJSON(b []byte) error
- func (uuid *UUID) UnmarshalText(b []byte) error
- func (uuid UUID) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
var Error = errs.Class("uuid")
Error is the default error class for uuid.
Functions ¶
func SortAscending ¶
func SortAscending(uuids []UUID)
SortAscending orders a slice of UUIDs from low to high.
Types ¶
type NullUUID ¶
NullUUID represents a UUID that may be null. NullUUID implements the Scanner interface so it can be used as a scan destination, similar to sql.NullString.
func (*NullUUID) DecodeSpanner ¶
DecodeSpanner implements spanner.Decoder.
func (NullUUID) EncodeSpanner ¶
EncodeSpanner implements spanner.Encoder.
type UUID ¶
type UUID [16]byte
UUID is big-endian encoded UUID.
UUID can be of any version or variant.
func FromBytes ¶
FromBytes converts big-endian raw-bytes to an UUID.
FromBytes allows for any version or variant of an UUID.
func FromString ¶
FromString parses "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" and "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" string.
FromString allows for any version or variant of an UUID.
func (UUID) Compare ¶
Compare returns an integer comparing uuid and other lexicographically. The result will be 0 if uuid==other, -1 if uuid < other, and +1 if uuid > other.
func (*UUID) DecodeSpanner ¶
DecodeSpanner implements spanner.Decoder.
func (UUID) EncodeSpanner ¶
EncodeSpanner implements spanner.Encoder.
func (UUID) MarshalJSON ¶
MarshalJSON marshals UUID in `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"` form.
func (UUID) MarshalText ¶
MarshalText marshals UUID in `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` form.
func (*UUID) UnmarshalJSON ¶
UnmarshalJSON unmarshals UUID from `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"`.
func (*UUID) UnmarshalText ¶
UnmarshalText unmarshals UUID from `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`.