Skip to content

Commit ad2043b

Browse files
committed
doc: update doc strings
1 parent be813fc commit ad2043b

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

generator.go

+13-7
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,16 @@ func (g *Gen) NewV5(ns UUID, name string) UUID {
269269
return u
270270
}
271271

272-
// NewV6 returns a k-sortable UUID based on a timestamp and 48 bits of
272+
// NewV6 returns a k-sortable UUID based on the current timestamp and 48 bits of
273273
// pseudorandom data. The timestamp in a V6 UUID is the same as V1, with the bit
274274
// order being adjusted to allow the UUID to be k-sortable.
275275
func (g *Gen) NewV6() (UUID, error) {
276276
return g.NewV6AtTime(g.epochFunc())
277277
}
278278

279+
// NewV6 returns a k-sortable UUID based on the provided timestamp and 48 bits of
280+
// pseudorandom data. The timestamp in a V6 UUID is the same as V1, with the bit
281+
// order being adjusted to allow the UUID to be k-sortable.
279282
func (g *Gen) NewV6AtTime(atTime time.Time) (UUID, error) {
280283
/* https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-6
281284
0 1 2 3
@@ -315,12 +318,14 @@ func (g *Gen) NewV6AtTime(atTime time.Time) (UUID, error) {
315318
return u, nil
316319
}
317320

318-
// NewV7 returns a k-sortable UUID based on the current millisecond precision
321+
// NewV7 returns a k-sortable UUID based on the current millisecond-precision
319322
// UNIX epoch and 74 bits of pseudorandom data.
320323
func (g *Gen) NewV7() (UUID, error) {
321324
return g.NewV7AtTime(g.epochFunc())
322325
}
323326

327+
// NewV7 returns a k-sortable UUID based on the provided millisecond-precision
328+
// UNIX epoch and 74 bits of pseudorandom data.
324329
func (g *Gen) NewV7AtTime(atTime time.Time) (UUID, error) {
325330
var u UUID
326331
/* https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-7
@@ -368,11 +373,12 @@ func (g *Gen) NewV7AtTime(atTime time.Time) (UUID, error) {
368373
return u, nil
369374
}
370375

371-
// getClockSequence returns the epoch and clock sequence for V1,V6 and V7 UUIDs.
372-
//
373-
// When useUnixTSMs is false, it uses the Coordinated Universal Time (UTC) as a count of 100-
376+
// getClockSequence returns the epoch and clock sequence of the provided time,
377+
// used for generating V1,V6 and V7 UUIDs.
374378
//
375-
// nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to the Christian calendar).
379+
// When useUnixTSMs is false, it uses the Coordinated Universal Time (UTC) as a count of
380+
// 100-nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of Gregorian
381+
// reform to the Christian calendar).
376382
func (g *Gen) getClockSequence(useUnixTSMs bool, atTime time.Time) (uint64, uint16, error) {
377383
var err error
378384
g.clockSequenceOnce.Do(func() {
@@ -430,7 +436,7 @@ func (g *Gen) getHardwareAddr() ([]byte, error) {
430436
}
431437

432438
// Returns the difference between UUID epoch (October 15, 1582)
433-
// and current time in 100-nanosecond intervals.
439+
// and the provided time in 100-nanosecond intervals.
434440
func (g *Gen) getEpoch(atTime time.Time) uint64 {
435441
return epochStart + uint64(atTime.UnixNano()/100)
436442
}

0 commit comments

Comments
 (0)