Documentation ¶
Index ¶
- Constants
- type UUID
- func MaxTimeUUID(t time.Time) UUID
- func MinTimeUUID(t time.Time) UUID
- func ParseUUID(input string) (UUID, error)
- func RandomUUID() (UUID, error)
- func TimeUUID() UUID
- func TimeUUIDWith(t int64, clock uint32, node []byte) UUID
- func UUIDFromBytes(input []byte) (UUID, error)
- func UUIDFromTime(t time.Time) UUID
- func UUIDFromTimeNode(t time.Time, node []byte) UUID
- func (u UUID) Bytes() []byte
- func (u UUID) Clock() uint32
- func (u UUID) MarshalJSON() ([]byte, error)
- func (u UUID) MarshalText() ([]byte, error)
- func (u UUID) Node() []byte
- func (u UUID) String() string
- func (u UUID) Time() time.Time
- func (u UUID) Timestamp() int64
- func (u *UUID) UnmarshalJSON(data []byte) error
- func (u *UUID) UnmarshalText(text []byte) (err error)
- func (u UUID) Variant() int
- func (u UUID) Version() int
Constants ¶
const ( VariantNCSCompat = 0 VariantIETF = 2 VariantMicrosoft = 6 VariantFuture = 7 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UUID ¶
type UUID [16]byte
func MaxTimeUUID ¶
MaxTimeUUID generates a "fake" time based UUID (version 1) which will be the biggest possible UUID generated for the provided timestamp.
UUIDs generated by this function are not unique and are mostly suitable only in queries to select a time range of a Cassandra's TimeUUID column.
func MinTimeUUID ¶
MinTimeUUID generates a "fake" time based UUID (version 1) which will be the smallest possible UUID generated for the provided timestamp.
UUIDs generated by this function are not unique and are mostly suitable only in queries to select a time range of a Cassandra's TimeUUID column.
func ParseUUID ¶
ParseUUID parses a 32 digit hexadecimal number (that might contain hypens) representing an UUID.
func RandomUUID ¶
RandomUUID generates a totally random UUID (version 4) as described in RFC 4122.
func TimeUUID ¶
func TimeUUID() UUID
TimeUUID generates a new time based UUID (version 1) using the current time as the timestamp.
func TimeUUIDWith ¶
TimeUUIDWith generates a new time based UUID (version 1) as described in RFC4122 with given parameters. t is the number of 100's of nanoseconds since 15 Oct 1582 (60bits). clock is the number of clock sequence (14bits). node is a slice to gurarantee the uniqueness of the UUID (up to 6bytes). Note: calling this function does not increment the static clock sequence.
func UUIDFromBytes ¶
UUIDFromBytes converts a raw byte slice to an UUID.
func UUIDFromTime ¶
UUIDFromTime generates a new time based UUID (version 1) as described in RFC 4122. This UUID contains the MAC address of the node that generated the UUID, the given timestamp and a sequence number.
func UUIDFromTimeNode ¶
UUIDFromTimeNode generates a new time based UUID (version 1) based on a user-submitted node and time struct
func (UUID) Bytes ¶
Bytes returns the raw byte slice for this UUID. A UUID is always 128 bits (16 bytes) long.
func (UUID) Clock ¶
Clock extracts the clock sequence of this UUID. It will return zero if the UUID is not a time based UUID (version 1).
func (UUID) MarshalText ¶
func (UUID) Node ¶
Node extracts the MAC address of the node who generated this UUID. It will return nil if the UUID is not a time based UUID (version 1).
func (UUID) String ¶
String returns the UUID in it's canonical form, a 32 digit hexadecimal number in the form of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
func (UUID) Timestamp ¶
Timestamp extracts the timestamp information from a time based UUID (version 1).