v0.0.352
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m1s

This commit is contained in:
Mike Schwörer 2023-12-29 19:29:36 +01:00
parent f9ccafb976
commit 0eda32b725
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 10 additions and 6 deletions

View File

@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.351"
const GoextVersion = "0.0.352"
const GoextVersionTimestamp = "2023-12-29T19:25:36+0100"
const GoextVersionTimestamp = "2023-12-29T19:29:36+0100"

View File

@ -52,20 +52,24 @@ var ConverterRFCUnixTimeToUnixSeconds = NewDBTypeConverter[rfctime.UnixTime, int
return rfctime.NewUnix(time.Unix(v, 0)), nil
})
// ConverterRFC339TimeToString
// Does not really use RFC339 - but sqlite does not understand timezones and the `T` delimiter
var ConverterRFC339TimeToString = NewDBTypeConverter[rfctime.RFC3339Time, string](func(v rfctime.RFC3339Time) (string, error) {
return v.Format(time.RFC3339), nil
return v.Time().In(time.UTC).Format("2006-01-02 15:04:05"), nil
}, func(v string) (rfctime.RFC3339Time, error) {
t, err := time.Parse(time.RFC3339Nano, v)
t, err := time.Parse("2006-01-02 15:04:05", v)
if err != nil {
return rfctime.RFC3339Time{}, err
}
return rfctime.NewRFC3339(t), nil
})
// ConverterRFC339NanoTimeToString
// Does not really use RFC339 - but sqlite does not understand timezones and the `T` delimiter
var ConverterRFC339NanoTimeToString = NewDBTypeConverter[rfctime.RFC3339NanoTime, string](func(v rfctime.RFC3339NanoTime) (string, error) {
return v.Format(time.RFC3339Nano), nil
return v.Time().In(time.UTC).Format("2006-01-02 15:04:05.999999999"), nil
}, func(v string) (rfctime.RFC3339NanoTime, error) {
t, err := time.Parse(time.RFC3339Nano, v)
t, err := time.ParseInLocation("2006-01-02 15:04:05.999999999", v, time.UTC)
if err != nil {
return rfctime.RFC3339NanoTime{}, err
}