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
74
+
// NewV6 returns a k-sortable UUID based on the current timestamp and 48 bits of
70
75
// pseudorandom data. The timestamp in a V6 UUID is the same as V1, with the bit
71
76
// order being adjusted to allow the UUID to be k-sortable.
72
77
funcNewV6() (UUID, error) {
73
78
returnDefaultGenerator.NewV6()
74
79
}
75
80
76
-
// NewV7 returns a k-sortable UUID based on the current millisecond precision
77
-
// 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.
81
+
// NewV6 returns a k-sortable UUID based on the provided timestamp and 48 bits of
82
+
// pseudorandom data. The timestamp in a V6 UUID is the same as V1, with the bit
83
+
// order being adjusted to allow the UUID to be k-sortable.
84
+
funcNewV6AtTime(atTime time.Time) (UUID, error) {
85
+
returnDefaultGenerator.NewV6AtTime(atTime)
86
+
}
87
+
88
+
// NewV7 returns a k-sortable UUID based on the current millisecond-precision
89
+
// UNIX epoch and 74 bits of pseudorandom data. It supports single-node batch
90
+
// generation (multiple UUIDs in the same timestamp) with a Monotonic Random counter.
78
91
funcNewV7() (UUID, error) {
79
92
returnDefaultGenerator.NewV7()
80
93
}
81
94
95
+
// NewV7 returns a k-sortable UUID based on the provided millisecond-precision
96
+
// UNIX epoch and 74 bits of pseudorandom data. It supports single-node batch
97
+
// generation (multiple UUIDs in the same timestamp) with a Monotonic Random counter.
98
+
funcNewV7AtTime(atTime time.Time) (UUID, error) {
99
+
returnDefaultGenerator.NewV7AtTime(atTime)
100
+
}
101
+
82
102
// Generator provides an interface for generating UUIDs.
83
103
typeGeneratorinterface {
84
104
NewV1() (UUID, error)
105
+
NewV1AtTime(time.Time) (UUID, error)
85
106
NewV3(nsUUID, namestring) UUID
86
107
NewV4() (UUID, error)
87
108
NewV5(nsUUID, namestring) UUID
88
109
NewV6() (UUID, error)
110
+
NewV6AtTime(time.Time) (UUID, error)
89
111
NewV7() (UUID, error)
112
+
NewV7AtTime(time.Time) (UUID, error)
90
113
}
91
114
92
115
// Gen is a reference UUID generator based on the specifications laid out in
0 commit comments