diff --git a/go.mod b/go.mod index 900c1a6..ed258fb 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( ) require ( - github.com/bytedance/sonic v1.11.1 // indirect + github.com/bytedance/sonic v1.11.2 // indirect github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect github.com/chenzhuoyu/iasm v0.9.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect diff --git a/go.sum b/go.sum index 042c7f2..194a89e 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,8 @@ github.com/bytedance/sonic v1.11.0 h1:FwNNv6Vu4z2Onf1++LNzxB/QhitD8wuTdpZzMTGITW github.com/bytedance/sonic v1.11.0/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= github.com/bytedance/sonic v1.11.1 h1:JC0+6c9FoWYYxakaoa+c5QTtJeiSZNeByOBhXtAFSn4= github.com/bytedance/sonic v1.11.1/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= +github.com/bytedance/sonic v1.11.2 h1:ywfwo0a/3j9HR8wsYGWsIWl2mvRsI950HyoxiBERw5A= +github.com/bytedance/sonic v1.11.2/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0= diff --git a/goextVersion.go b/goextVersion.go index 74cd1fe..632f20b 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.395" +const GoextVersion = "0.0.396" -const GoextVersionTimestamp = "2024-02-27T13:42:06+0100" +const GoextVersionTimestamp = "2024-02-28T14:28:48+0100" diff --git a/sq/converter.go b/sq/converter.go index 1f3a1d3..1bab667 100644 --- a/sq/converter.go +++ b/sq/converter.go @@ -7,6 +7,7 @@ import ( "gogs.mikescher.com/BlackForestBytes/goext/exerr" "gogs.mikescher.com/BlackForestBytes/goext/langext" "gogs.mikescher.com/BlackForestBytes/goext/rfctime" + "gogs.mikescher.com/BlackForestBytes/goext/timeext" "reflect" "strconv" "strings" @@ -114,6 +115,12 @@ var ConverterRFCTimeToString = NewDBTypeConverter[rfctime.Time, string](func(v r return res, nil }) +var ConverterRFCSecondsF64ToString = NewDBTypeConverter[rfctime.SecondsF64, float64](func(v rfctime.SecondsF64) (float64, error) { + return v.Seconds(), nil +}, func(v float64) (rfctime.SecondsF64, error) { + return rfctime.NewSecondsF64(timeext.FromSeconds(v)), nil +}) + var ConverterJsonObjToString = NewDBTypeConverter[JsonObj, string](func(v JsonObj) (string, error) { mrsh, err := json.Marshal(v) if err != nil { diff --git a/sq/database.go b/sq/database.go index b9b9213..127a760 100644 --- a/sq/database.go +++ b/sq/database.go @@ -143,17 +143,22 @@ func (db *database) RegisterConverter(conv DBTypeConverter) { func (db *database) RegisterDefaultConverter() { db.RegisterConverter(ConverterBoolToBit) + db.RegisterConverter(ConverterTimeToUnixMillis) + db.RegisterConverter(ConverterRFCUnixMilliTimeToUnixMillis) db.RegisterConverter(ConverterRFCUnixNanoTimeToUnixNanos) db.RegisterConverter(ConverterRFCUnixTimeToUnixSeconds) db.RegisterConverter(ConverterRFC339TimeToString) db.RegisterConverter(ConverterRFC339NanoTimeToString) + db.RegisterConverter(ConverterRFCDateToString) + db.RegisterConverter(ConverterRFCTimeToString) + db.RegisterConverter(ConverterRFCSecondsF64ToString) + db.RegisterConverter(ConverterJsonObjToString) db.RegisterConverter(ConverterJsonArrToString) + db.RegisterConverter(ConverterExErrCategoryToString) db.RegisterConverter(ConverterExErrSeverityToString) db.RegisterConverter(ConverterExErrTypeToString) - db.RegisterConverter(ConverterRFCDateToString) - db.RegisterConverter(ConverterRFCTimeToString) }