Documentation ¶
Index ¶
- Constants
- Variables
- type UUID
- func (u UUID) Bytes() []byte
- 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
- type UUIDGeneratorService
- type UUIDGeneratorServiceImpl
Constants ¶
const ( // VariantNCSCompat defines VariantNCSCompat = 0 // VariantIETF defines VariantIETF = 2 // VariantMicrosoft defines VariantMicrosoft = 6 // VariantFuture defines VariantFuture = 7 )
Variables ¶
var EmptyUUID = UUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
EmptyUUID represents an empty UUID
Functions ¶
This section is empty.
Types ¶
type UUID ¶
type UUID [16]byte
UUID represents an identifier standard used in software construction. A UUID is simply a 128-bit value. The meaning of each bit is defined by any of several variants.
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 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 (UUID) Bytes ¶
Bytes returns the raw byte slice for this UUID. A UUID is always 128 bits (16 bytes) long.
func (UUID) MarshalJSON ¶
MarshalJSON Marshaling for JSON
func (UUID) MarshalText ¶
MarshalText marshaling for text
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).
func (*UUID) UnmarshalJSON ¶
UnmarshalJSON Unmarshaling for JSON
func (*UUID) UnmarshalText ¶
UnmarshalText unmarshalling for text
type UUIDGeneratorService ¶
type UUIDGeneratorService interface { // Generates random UUID value. // Either the new random generated UUID or an error if something goes wrong. GenerateRandomUUID() (UUID, error) }
UUIDGeneratorService defines the interface that will generate random UUID, will be used to inject UUID generator service implementation to different services.
type UUIDGeneratorServiceImpl ¶
type UUIDGeneratorServiceImpl struct { }
UUIDGeneratorServiceImpl is the default implementation of UUID generator service
func (UUIDGeneratorServiceImpl) GenerateRandomUUID ¶
func (UUIDGeneratorServiceImpl) GenerateRandomUUID() (UUID, error)
GenerateRandomUUID generates random UUID value. Returns either the new random generated UUID or an error if something goes wrong.