Documentation
¶
Index ¶
- func GenerateUUIDv7() uuid.UUID
- func GenerateUUIDv7WithOffset(offset time.Duration) uuid.UUID
- func GenerateUUIDv7WithTime(t time.Time) uuid.UUID
- func GenerateUUIDv7WithUnixTimestamp(timestamp int64) uuid.UUID
- func IsUUIDv7(id uuid.UUID) bool
- func IsUUIDv7TimeValid(id uuid.UUID) bool
- func IsValidUUIDv7(s string) bool
- func MustParseUUIDv7(s string) uuid.UUID
- func ParseUUIDv7(s string) (uuid.UUID, error)
- func ParseUUIDv7Time(id uuid.UUID) (time.Time, error)
- func UUIDv7Batch(count int) ([]uuid.UUID, error)
- func UUIDv7BatchWithTime(t time.Time, count int) ([]uuid.UUID, error)
- func UUIDv7Cursor(id uuid.UUID) string
- func UUIDv7FromBytes(b []byte) (uuid.UUID, error)
- func UUIDv7FromCursor(cursor string) (uuid.UUID, error)
- func UUIDv7FromTimeRange(start, end time.Time) (uuid.UUID, error)
- func UUIDv7Sortable(id1, id2 uuid.UUID) bool
- func UUIDv7TimeDifference(id1, id2 uuid.UUID) (time.Duration, error)
- func UUIDv7TimeRange() (time.Time, time.Time)
- func UUIDv7ToBytes(id uuid.UUID) ([]byte, error)
- type UUIDv7Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateUUIDv7WithOffset ¶
GenerateUUIDv7WithOffset generates UUIDv7 with time offset from current time
func GenerateUUIDv7WithTime ¶
GenerateUUIDv7WithTime generates UUIDv7 with specific time according to RFC 9562 The first 48 bits contain the timestamp in milliseconds since Unix epoch The next 16 bits contain version (7) and variant The remaining 74 bits contain random data
func GenerateUUIDv7WithUnixTimestamp ¶
GenerateUUIDv7WithUnixTimestamp generates UUIDv7 from Unix timestamp in milliseconds
func IsUUIDv7TimeValid ¶
IsUUIDv7TimeValid checks if the time embedded in UUIDv7 is within valid range
func IsValidUUIDv7 ¶
IsValidUUIDv7 checks if a string is a valid UUIDv7
func MustParseUUIDv7 ¶
MustParseUUIDv7 parses a string into UUIDv7, panics if not valid
func ParseUUIDv7 ¶
ParseUUIDv7 parses a string into UUIDv7, returns error if not valid UUIDv7
func ParseUUIDv7Time ¶
ParseUUIDv7Time extracts timestamp from UUIDv7 according to RFC 9562 Returns the timestamp embedded in the first 48 bits
func UUIDv7Batch ¶
UUIDv7Batch generates a batch of UUIDv7s
func UUIDv7BatchWithTime ¶
UUIDv7BatchWithTime generates a batch of UUIDv7s with specific time
func UUIDv7Cursor ¶
UUIDv7Cursor creates a cursor string from UUIDv7 for pagination
func UUIDv7FromBytes ¶
UUIDv7FromBytes creates UUIDv7 from byte slice
func UUIDv7FromCursor ¶
UUIDv7FromCursor creates UUIDv7 from cursor string
func UUIDv7FromTimeRange ¶
UUIDv7FromTimeRange generates UUIDv7 within a time range
func UUIDv7Sortable ¶
UUIDv7Sortable returns true if UUIDv7s are sortable by time
func UUIDv7TimeDifference ¶
UUIDv7TimeDifference calculates the time difference between two UUIDv7s
func UUIDv7TimeRange ¶
UUIDv7TimeRange returns the time range for UUIDv7 generation
Types ¶
type UUIDv7Validator ¶
UUIDv7Validator validates UUIDv7 properties
func NewUUIDv7Validator ¶
func NewUUIDv7Validator() *UUIDv7Validator
NewUUIDv7Validator creates a new UUIDv7 validator
func (*UUIDv7Validator) Validate ¶
func (v *UUIDv7Validator) Validate(id uuid.UUID) error
Validate validates a UUIDv7
func (*UUIDv7Validator) ValidateString ¶
func (v *UUIDv7Validator) ValidateString(s string) error
ValidateString validates a UUIDv7 string