Skip to content

Commit

Permalink
types#UnixMilli.Scan(): Support uint64
Browse files Browse the repository at this point in the history
  • Loading branch information
lippserd committed Apr 25, 2024
1 parent cc15d0d commit f3670cc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/types/unix_milli.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ func (t *UnixMilli) Scan(src interface{}) error {
switch v := src.(type) {
case []byte:
return t.fromByteString(v)
// https://github.com/go-sql-driver/mysql/pull/1452
case uint64:
*t = UnixMilli(time.UnixMilli(int64(v)))
case int64:
*t = UnixMilli(time.UnixMilli(v))

return nil
default:
return errors.Errorf("bad int64/[]byte type assertion from %#v", src)
return errors.Errorf("bad (u)int64/[]byte type assertion from %[1]v (%[1]T)", src)
}

return nil
}

// Value implements the driver.Valuer interface.
Expand Down

0 comments on commit f3670cc

Please sign in to comment.