uuid

package
v1.13.0-beta.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b UUID) int

Compare returns an integer comparing two UUIDs. The result will be 0 if a==b, -1 if a < b, and +1 if a > b.

Types

type UUID

type UUID struct {
	// contains filtered or unexported fields
}

UUID is a wrapper for a UUID type.

var Nil UUID

Nil UUID is special form of UUID that is specified to have all 128 bits set to zero (see https://tools.ietf.org/html/rfc4122#section-4.1.7).

func MustParse

func MustParse(s string) UUID

MustParse creates a new UUID from string and panics if s is not an UUID.

func MustRandom

func MustRandom() UUID

MustRandom works like NewRandom but will panic on error.

func NewFromUint64

func NewFromUint64(l, h uint64) UUID

NewFromUint64 creates a UUID from a uint64 pair.

func NewRandom

func NewRandom() (UUID, error)

NewRandom returns a random (Version 4) UUID and error if it fails to read from it's random source.

func NewTime

func NewTime() UUID

NewTime generates a new time based UUID (version 1) using the current time as the timestamp.

func Parse

func Parse(s string) (UUID, error)

Parse creates a new UUID from string.

func (UUID) Bytes

func (u UUID) Bytes() []byte

Bytes returns the raw byte slice for this UUID. A UUID is always 128 bits (16 bytes) long.

func (UUID) Bytes16

func (u UUID) Bytes16() [16]byte

Bytes16 returns the raw byte array for this UUID.

func (UUID) MarshalCQL

func (u UUID) MarshalCQL(info gocql.TypeInfo) ([]byte, error)

MarshalCQL implements gocql.Marshaler.

func (UUID) MarshalJSON

func (u UUID) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaller.

func (UUID) MarshalText

func (u UUID) MarshalText() ([]byte, error)

MarshalText implements text.Marshaller.

func (UUID) String

func (u UUID) String() 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) UnmarshalCQL

func (u *UUID) UnmarshalCQL(info gocql.TypeInfo, data []byte) error

UnmarshalCQL implements gocql.Unmarshaler.

func (*UUID) UnmarshalJSON

func (u *UUID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*UUID) UnmarshalText

func (u *UUID) UnmarshalText(text []byte) error

UnmarshalText implements text.Marshaller.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL