Documentation
¶
Index ¶
- Variables
- func NewString() string
- type UUID
- func (uuid UUID) Bytes() []byte
- func (uuid UUID) Equal(other UUID) bool
- func (uuid UUID) IsNil() bool
- func (uuid UUID) MarshalBinary() ([]byte, error)
- func (uuid UUID) MarshalText() ([]byte, error)
- func (uuid *UUID) SetVariant()
- func (uuid *UUID) SetVersion(v byte)
- func (uuid UUID) String() string
- func (uuid UUID) Timestamp() time.Time
- func (uuid UUID) ToUint64Pair() (uint64, uint64)
- func (uuid UUID) URN() string
- func (uuid *UUID) UnmarshalBinary(data []byte) error
- func (uuid *UUID) UnmarshalText(data []byte) error
- func (uuid UUID) Variant() int
- func (uuid UUID) Version() int
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidUUIDLength = errors.New("invalid UUID length") ErrInvalidUUIDFormat = errors.New("invalid UUID format") )
Functions ¶
Types ¶
type UUID ¶
type UUID [16]byte
UUID is a 128-bit universally unique identifier.
func FromUint64Pair ¶
FromUint64Pair creates a UUID from two uint64 values.
func NewRandom ¶
NewRandom generates a new random UUID v4 and returns an error if the random source fails.
func NewV7 ¶
NewV7 generates a new UUID v7 based on the current timestamp. UUID v7 uses a Unix timestamp in milliseconds for time-ordering.
func NewV7FromTime ¶
NewV7FromTime generates a UUID v7 from a specific timestamp.
func (UUID) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler.
func (UUID) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*UUID) SetVariant ¶
func (uuid *UUID) SetVariant()
SetVariant sets the variant bits to RFC 4122.
func (*UUID) SetVersion ¶
SetVersion sets the version bits of the UUID.
func (UUID) String ¶
String returns the string representation of the UUID in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
func (UUID) Timestamp ¶
Timestamp returns the timestamp from a UUID v7. For non-v7 UUIDs, the result is undefined.
func (UUID) ToUint64Pair ¶
ToUint64Pair returns the UUID as two uint64 values (high and low).
func (*UUID) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (*UUID) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.