mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-04-22 23:58:46 +02:00
[#2602] added common int types support when scanning types.DateTime
This commit is contained in:
parent
dbbc1e25ca
commit
3122223a71
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
- Fixed the selfupdate command not working on Windows due to missing `.exe` in the extracted binary path ([#2589](https://github.com/pocketbase/pocketbase/discussions/2589)).
|
- Fixed the selfupdate command not working on Windows due to missing `.exe` in the extracted binary path ([#2589](https://github.com/pocketbase/pocketbase/discussions/2589)).
|
||||||
|
|
||||||
|
- Added `int64`, `int32`, `uint`, `uint64` and `uint32` support when scanning `types.DateTime` ([#2602](https://github.com/pocketbase/pocketbase/discussions/2602))
|
||||||
|
|
||||||
|
|
||||||
## v0.16.3
|
## v0.16.3
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ func (d *DateTime) Scan(value any) error {
|
|||||||
d.t = v.Time()
|
d.t = v.Time()
|
||||||
case time.Time:
|
case time.Time:
|
||||||
d.t = v
|
d.t = v
|
||||||
case int:
|
case int, int64, int32, uint, uint64, uint32:
|
||||||
d.t = cast.ToTime(v)
|
d.t = cast.ToTime(v)
|
||||||
case string:
|
case string:
|
||||||
if v == "" {
|
if v == "" {
|
||||||
|
@ -32,6 +32,11 @@ func TestParseDateTime(t *testing.T) {
|
|||||||
{nowDateTime, nowStr},
|
{nowDateTime, nowStr},
|
||||||
{nowTime, nowStr},
|
{nowTime, nowStr},
|
||||||
{1641024040, "2022-01-01 08:00:40.000Z"},
|
{1641024040, "2022-01-01 08:00:40.000Z"},
|
||||||
|
{int32(1641024040), "2022-01-01 08:00:40.000Z"},
|
||||||
|
{int64(1641024040), "2022-01-01 08:00:40.000Z"},
|
||||||
|
{uint(1641024040), "2022-01-01 08:00:40.000Z"},
|
||||||
|
{uint64(1641024040), "2022-01-01 08:00:40.000Z"},
|
||||||
|
{uint32(1641024040), "2022-01-01 08:00:40.000Z"},
|
||||||
{"2022-01-01 11:23:45.678", "2022-01-01 11:23:45.678Z"},
|
{"2022-01-01 11:23:45.678", "2022-01-01 11:23:45.678Z"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user