uuid_v1

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UUIDv1_VARIANT_RESERVED_NCS_BACKWARD_COMPATIBLE = 0x00
	UUIDv1_VARIANT_RESERVED_RFC_4122_NAMESPACE_DNS  = 0x01
	UUIDv1_VARIANT_RESERVED_RFC_4122_NAMESPACE_URL  = 0x02
	UUIDv1_VARIANT_RESERVED_RFC_4122_NAMESPACE_OID  = 0x03
	UUIDv1_VARIANT_RESERVED_RFC_4122_NAMESPACE_X500 = 0x04
	UUIDv1_VARIANT_RESERVED_FUTURE_USE              = 0x05
	UUIDv1_VARIANT_RESERVED_FOR_NCS_COMPATIBILITY   = 0x06
	UUIDv1_VARIANT_RESERVED_FOR_FUTURE_USE          = 0x07

	UUIDv1Epoch = uint64(122192928000000000)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type UUIDv1

type UUIDv1 struct {
	Time     uint64
	Version  uint8
	Variant  uint8
	ClockSeq uint16
	NodeID   [6]byte
}

UUIDv1 represents a UUID v1 structure

func (*UUIDv1) FromBytes

func (u *UUIDv1) FromBytes(data []byte) error

FromBytes creates a UUIDv1 from a 16-byte array

func (*UUIDv1) FromString

func (u *UUIDv1) FromString(uuidStr string) error

Decode parses a UUID string in the format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" and returns a UUIDv1 structure.

func (*UUIDv1) GetClockSequence

func (u *UUIDv1) GetClockSequence() uint16

GetClockSequence returns the clock sequence of the UUIDv1 structure

func (*UUIDv1) GetNodeID

func (u *UUIDv1) GetNodeID() []byte

GetNodeID returns the node ID of the UUIDv1 structure

func (*UUIDv1) GetTime

func (u *UUIDv1) GetTime() time.Time

GetTime returns the time of the UUIDv1 structure

func (*UUIDv1) Marshal

func (u *UUIDv1) Marshal() ([]byte, error)

Marshal converts the UUIDv1 structure to a 16-byte array

func (*UUIDv1) String

func (u *UUIDv1) String() string

String returns the string representation of the UUIDv1 structure

func (*UUIDv1) Unmarshal

func (u *UUIDv1) Unmarshal(marshalledData []byte) (int, error)

Unmarshal converts a 16-byte array into a UUIDv1 structure

Jump to

Keyboard shortcuts

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