Changeset 0.28.0.2 (#174)

This commit is contained in:
2026-03-11 19:41:04 +00:00
parent 58313f7e31
commit 8e08f3e4b0
19 changed files with 1734 additions and 384 deletions

View File

@@ -33,6 +33,12 @@ func (s *sqliteTime) Scan(src interface{}) error {
case time.Time:
*s.t = v
return nil
case int64:
// modernc/sqlite stores Go time.Time as Unix timestamp (int64).
// This happens when code passes *time.Time directly as a ?
// parameter instead of using datetime('now') in SQL.
*s.t = time.Unix(v, 0).UTC()
return nil
case string:
for _, f := range timeFormats {
if p, err := time.Parse(f, v); err == nil {
@@ -51,6 +57,8 @@ var timeFormats = []string{
"2006-01-02T15:04:05Z",
time.RFC3339,
"2006-01-02 15:04:05.000000000+00:00",
"2006-01-02 15:04:05Z07:00", // modernc: time.Time UTC → "2025-03-11 16:00:00Z"
"2006-01-02 15:04:05.999999999Z07:00", // modernc: time.Time with fractional seconds
}
// stN wraps a *time.Time pointer for nullable columns.