Documentation
¶
Overview ¶
Implements "Version 6" UUIDs in Go. See http://bradleypeabody.github.io/uuidv6/ UUIDs sort correctly by time when naively sorted as raw bytes, have a Time() function that returns time the UUID was created and have a reasonable guarantee of being globally unique (based on the specifications from RFC 4122, with a few intentional exceptions.)
Index ¶
- Variables
- func RandomizeNode()
- type UUID
- func (u UUID) Bytes() []byte
- func (u UUID) Compare(to UUID) bool
- func (u *UUID) ExtensionType() int8
- func (u UUID) IsNil() bool
- func (u *UUID) Len() int
- func (u UUID) MarshalBinary() ([]byte, error)
- func (u *UUID) MarshalBinaryTo(b []byte) error
- func (u UUID) MarshalJSON() ([]byte, error)
- func (u UUID) MarshalText() ([]byte, error)
- func (u *UUID) Scan(value interface{}) error
- func (u UUID) String() string
- func (u UUID) Time() time.Time
- func (u *UUID) UnmarshalBinary(data []byte) error
- func (u *UUID) UnmarshalJSON(data []byte) error
- func (u *UUID) UnmarshalText(text []byte) (err error)
- func (u UUID) Value() (driver.Value, error)
- type UUIDB64
- func (u UUIDB64) Bytes() []byte
- func (u UUIDB64) IsNil() bool
- func (u UUIDB64) MarshalBinary() ([]byte, error)
- func (u UUIDB64) MarshalJSON() ([]byte, error)
- func (u UUIDB64) MarshalText() ([]byte, error)
- func (u *UUIDB64) Scan(value interface{}) error
- func (u UUIDB64) String() string
- func (u UUIDB64) Time() time.Time
- func (u *UUIDB64) UnmarshalBinary(data []byte) error
- func (u *UUIDB64) UnmarshalJSON(data []byte) error
- func (u *UUIDB64) UnmarshalText(text []byte) (err error)
- func (u UUIDB64) Value() (driver.Value, error)
- type UUIDB64Slice
- type UUIDSlice
Constants ¶
This section is empty.
Variables ¶
var Base64UUIDAlphabet = `-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz`
Base64UUIDAlphabet uses the same characters as "url safe" base64, but puts them in ascii sequence so encoded data sorts the same as the raw bytes.
var Base64UUIDEncoding = base64.NewEncoding(Base64UUIDAlphabet).WithPadding(base64.NoPadding)
Base64UUIDEncoding is a base64.Encoding that has no padding and uses Base64UUIDAlphabet.
Functions ¶
func RandomizeNode ¶
func RandomizeNode()
Set the 'node' part of the UUID to a random value, instead of using one of the MAC addresses from the system. Use this if you are concerned about the privacy aspect of using a MAC address.
Types ¶
type UUID ¶
type UUID [16]byte
"Version 6" UUID.
func New ¶
func New() UUID
Return a new UUID initialized to a proper value according to "Version 6" rules.
func NewFromTime ¶
func (*UUID) ExtensionType ¶
func (UUID) MarshalBinary ¶
func (*UUID) MarshalBinaryTo ¶
func (UUID) MarshalJSON ¶
func (UUID) MarshalText ¶
func (UUID) String ¶
Textual representation per RFC 4122, e.g. "f81d4fae-7dec-11d0-a765-00a0c91e6bf6"
func (*UUID) UnmarshalBinary ¶
func (*UUID) UnmarshalJSON ¶
func (*UUID) UnmarshalText ¶
type UUIDB64 ¶
type UUIDB64 UUID
UUIDB64 is like UUID but encodes using a "base64 uuid" representation for it's string value (as well as in the database).
func NewB64FromTime ¶
func (UUIDB64) MarshalBinary ¶
func (UUIDB64) MarshalJSON ¶
func (UUIDB64) MarshalText ¶
func (*UUIDB64) UnmarshalBinary ¶
func (*UUIDB64) UnmarshalJSON ¶
func (*UUIDB64) UnmarshalText ¶
type UUIDB64Slice ¶
type UUIDB64Slice []UUIDB64
func (UUIDB64Slice) Len ¶
func (s UUIDB64Slice) Len() int
func (UUIDB64Slice) Less ¶
func (s UUIDB64Slice) Less(i, j int) bool
func (UUIDB64Slice) Swap ¶
func (s UUIDB64Slice) Swap(i, j int)