MCPcopy
hub / github.com/google/uuid / NewV7

Function NewV7

version7.go:23–30  ·  view source on GitHub ↗

UUID version 7 features a time-ordered value field derived from the widely implemented and well known Unix Epoch timestamp source, the number of milliseconds seconds since midnight 1 Jan 1970 UTC, leap seconds excluded. As well as improved entropy characteristics over versions 1 or 6. see https://d

()

Source from the content-addressed store, hash-verified

21// Uses the randomness pool if it was enabled with EnableRandPool.
22// On error, NewV7 returns Nil and an error
23func NewV7() (UUID, error) {
24 uuid, err := NewRandom()
25 if err != nil {
26 return uuid, err
27 }
28 makeV7(uuid[:])
29 return uuid, nil
30}
31
32// NewV7FromReader returns a Version 7 UUID based on the current time(Unix Epoch).
33// it use NewRandomFromReader fill random bits.

Callers 4

TestVersion7Function · 0.85
TestVersion7_pooledFunction · 0.85
TestVersion7MonotonicityFunction · 0.85

Calls 2

NewRandomFunction · 0.85
makeV7Function · 0.85

Tested by 4

TestVersion7Function · 0.68
TestVersion7_pooledFunction · 0.68
TestVersion7MonotonicityFunction · 0.68