Generated from Manticore v1.1.5 • 201 packages. View on pkg.go.dev

uuid_v7

import "github.com/TheManticoreProject/Manticore/crypto/uuid/uuid_v7"

Index

type UUIDv7

UUIDv7 is a Unix-time and randomness based UUID (version 7) per RFC 4122bis. It embeds a 48-bit Unix millisecond timestamp and 74 bits of randomness with version and variant bits set accordingly.

type UUIDv7 struct {
    uuid.UUID
    // contains filtered or unexported fields
}

func (*UUIDv7) FromString

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

FromString parses a UUID string and validates that it is version 7.

func (*UUIDv7) Generate

func (u *UUIDv7) Generate() error

Generate creates a UUIDv7 using the current Unix time in milliseconds and random bits.

func (*UUIDv7) GetTime

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

GetTime returns the Unix time represented by the UUIDv7 timestamp (milliseconds precision).

func (*UUIDv7) Marshal

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

Marshal converts the UUIDv7 structure to a 16-byte array.

func (*UUIDv7) String

func (u *UUIDv7) String() string

String returns the canonical string form of the UUIDv7.

func (*UUIDv7) Unmarshal

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

Unmarshal converts a 16-byte array into a UUIDv7 structure.