You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// NewV6 returns a k-sortable UUID based on a timestamp and 48 bits of
71
71
// pseudorandom data. The timestamp in a V6 UUID is the same as V1, with the bit
72
72
// order being adjusted to allow the UUID to be k-sortable.
73
-
//
74
-
// This is implemented based on revision 03 of the Peabody UUID draft, and may
75
-
// be subject to change pending further revisions. Until the final specification
76
-
// revision is finished, changes required to implement updates to the spec will
77
-
// not be considered a breaking change. They will happen as a minor version
78
-
// releases until the spec is final.
79
73
funcNewV6() (UUID, error) {
80
74
returnDefaultGenerator.NewV6()
81
75
}
82
76
83
77
// NewV7 returns a k-sortable UUID based on the current millisecond precision
84
78
// UNIX epoch and 74 bits of pseudorandom data. It supports single-node batch generation (multiple UUIDs in the same timestamp) with a Monotonic Random counter.
85
-
//
86
-
// This is implemented based on revision 04 of the Peabody UUID draft, and may
87
-
// be subject to change pending further revisions. Until the final specification
88
-
// revision is finished, changes required to implement updates to the spec will
89
-
// not be considered a breaking change. They will happen as a minor version
90
-
// releases until the spec is final.
91
79
funcNewV7() (UUID, error) {
92
80
returnDefaultGenerator.NewV7()
93
81
}
@@ -103,7 +91,7 @@ type Generator interface {
103
91
}
104
92
105
93
// Gen is a reference UUID generator based on the specifications laid out in
106
-
// RFC-4122 and DCE 1.1: Authentication and Security Services. This type
94
+
// RFC-9562 and DCE 1.1: Authentication and Security Services. This type
107
95
// satisfies the Generator interface as defined in this package.
108
96
//
109
97
// For consumers who are generating V1 UUIDs, but don't want to expose the MAC
//support batching by using a monotonic pseudo-random sequence
339
+
//Support batching by using a monotonic pseudo-random sequence,
340
+
//as described in RFC 9562 section 6.2, Method 1.
385
341
//The 6th byte contains the version and partially rand_a data.
386
-
//We will lose the most significant bites from the clockSeq (with SetVersion), but it is ok, we need the least significant that contains the counter to ensure the monotonic property
342
+
//We will lose the most significant bites from the clockSeq (with SetVersion), but it is ok,
343
+
//we need the least significant that contains the counter to ensure the monotonic property
387
344
binary.BigEndian.PutUint16(u[6:8], clockSeq) // set rand_a with clock seq which is random and monotonic
0 commit comments