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

Function NewV7FromReader

version7.go:35–43  ·  view source on GitHub ↗

NewV7FromReader returns a Version 7 UUID based on the current time(Unix Epoch). it use NewRandomFromReader fill random bits. On error, NewV7FromReader returns Nil and an error.

(r io.Reader)

Source from the content-addressed store, hash-verified

33// it use NewRandomFromReader fill random bits.
34// On error, NewV7FromReader returns Nil and an error.
35func NewV7FromReader(r io.Reader) (UUID, error) {
36 uuid, err := NewRandomFromReader(r)
37 if err != nil {
38 return uuid, err
39 }
40
41 makeV7(uuid[:])
42 return uuid, nil
43}
44
45// makeV7 fill 48 bits time (uuid[0] - uuid[5]), set version b0111 (uuid[6])
46// uuid[8] already has the right version number (Variant is 10)

Callers 1

TestVersion7FromReaderFunction · 0.85

Calls 2

NewRandomFromReaderFunction · 0.85
makeV7Function · 0.85

Tested by 1

TestVersion7FromReaderFunction · 0.68