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