Documentation ¶
Index ¶
- Constants
- Variables
- func MustString(uuid UUID, err error) string
- type UUID
- func Must(uuid UUID, err error) UUID
- func NamespaceDNS() UUID
- func NamespaceOID() UUID
- func NamespaceURL() UUID
- func NamespaceX500() UUID
- func NewV1() (uuid UUID, err error)
- func NewV2() (uuid UUID, err error)
- func NewV3(ns UUID, name string) (uuid UUID, err error)
- func NewV4() (uuid UUID, err error)
- func NewV5(ns UUID, name string) (uuid UUID, err error)
- func NewV6() (uuid UUID, err error)
- func NewV7() (uuid UUID, err error)
- func NewV8() (uuid UUID, err error)
- func Parse(str string) (UUID, error)
- func ParseBytes(bytes []byte) (uuid UUID, err error)
- func (uuid UUID) IsMax() bool
- func (uuid UUID) IsNil() bool
- func (uuid UUID) MarshalBinary() ([]byte, error)
- func (uuid UUID) MarshalText() ([]byte, error)
- func (uuid *UUID) Scan(val interface{}) error
- func (uuid UUID) String() string
- func (uuid UUID) Timestamp() time.Time
- func (uuid *UUID) UnmarshalBinary(in []byte) error
- func (uuid *UUID) UnmarshalText(in []byte) error
- func (uuid UUID) Value() (driver.Value, error)
- func (uuid UUID) Version() int
Constants ¶
const EpochToUnix int64 = 122192928000000000
EpochToUnix represents the 100ns intervals between 1582-10-15T00:00:00.00Z and 1970-01-01T00:00:00.00Z
Variables ¶
var ( UseHardwareMAC bool = false // UseHardwareMAC defines whether to use a MAC address from a network card if available or generate one. It defaults to false for privacy reasons and because the MAC address lookup creates additional latency. RandomMAC net.HardwareAddr // Random MAC address - will be automatically generated unless set manually )
var CurrentTime func() time.Time = time.Now
CurrentTime is a function used to get the current time. It defaults to time.Now but can be set to a different function in case a different time source should be used.
Functions ¶
func MustString ¶
MustString works like Must but returns a string immediately
Types ¶
type UUID ¶
type UUID [16]byte
UUID represents a Universal Unique Identifier as an array containing 16 bytes
func NamespaceDNS ¶ added in v0.2.0
func NamespaceDNS() UUID
func NamespaceOID ¶ added in v0.2.0
func NamespaceOID() UUID
func NamespaceURL ¶ added in v0.2.0
func NamespaceURL() UUID
func NamespaceX500 ¶ added in v0.2.0
func NamespaceX500() UUID
func ParseBytes ¶
ParseBytes parses a byte slice and returns the contained BINARY UUID or an error
func (UUID) IsNil ¶
IsNil returns true if the UUID contains only zeros and is therefore empty and invalid
func (UUID) MarshalBinary ¶
MarshalBinary provides encoding.BinaryMarshaler
func (UUID) MarshalText ¶
MarshalText provides encoding.TextMarshaler
func (UUID) Timestamp ¶
Timestamp returns the timestamp of the UUID or nil if the UUID does not contain a timestamp
func (*UUID) UnmarshalBinary ¶
UnmarshalBinary provides encoding.BinaryUnmarshaler
func (*UUID) UnmarshalText ¶
UnmarshalText provides encoding.TextUnmarshaler