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)
| 33 | // it use NewRandomFromReader fill random bits. |
| 34 | // On error, NewV7FromReader returns Nil and an error. |
| 35 | func 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) |