MCPcopy Index your code
hub / github.com/riverqueue/river / timeStringNullable

Function timeStringNullable

riverdriver/riversqlite/river_sqlite_driver.go:1685–1692  ·  view source on GitHub ↗

This is kind of unfortunate, but I've found it the easiest way to encode an optional date/time. Unfortunately sqlc (or the driver? not sure) will write a `*time.Time` as an integer (presumably a Unix timestamp), and then be unable to scan it back into a `time.Time`. This workaround has us cast input

(t *time.Time)

Source from the content-addressed store, hash-verified

1683// no date/time type, only `integer` or `text`) to make sure it's in our desired
1684// target format.
1685func timeStringNullable(t *time.Time) *string {
1686 if t == nil {
1687 return nil
1688 }
1689
1690 str := timeString(*t)
1691 return &str
1692}

Callers 15

JobCancelMethod · 0.85
JobGetAvailableMethod · 0.85
JobInsertFullMethod · 0.85
JobRescueManyMethod · 0.85
JobRetryMethod · 0.85
JobScheduleMethod · 0.85
LeaderAttemptElectMethod · 0.85
LeaderAttemptReelectMethod · 0.85
LeaderDeleteExpiredMethod · 0.85
LeaderInsertMethod · 0.85

Calls 1

timeStringFunction · 0.85

Tested by 1

TestTimeStringNullableFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…