v0.0.396 sq.ConverterRFCSecondsF64ToString
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m2s

This commit is contained in:
Mike Schwörer 2024-02-28 14:28:48 +01:00
parent 10c3780b52
commit 3956675e04
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
5 changed files with 19 additions and 5 deletions

2
go.mod
View File

@ -15,7 +15,7 @@ require (
) )
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/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect

2
go.sum
View File

@ -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.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 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.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-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-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0= github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0=

View File

@ -1,5 +1,5 @@
package goext 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"

View File

@ -7,6 +7,7 @@ import (
"gogs.mikescher.com/BlackForestBytes/goext/exerr" "gogs.mikescher.com/BlackForestBytes/goext/exerr"
"gogs.mikescher.com/BlackForestBytes/goext/langext" "gogs.mikescher.com/BlackForestBytes/goext/langext"
"gogs.mikescher.com/BlackForestBytes/goext/rfctime" "gogs.mikescher.com/BlackForestBytes/goext/rfctime"
"gogs.mikescher.com/BlackForestBytes/goext/timeext"
"reflect" "reflect"
"strconv" "strconv"
"strings" "strings"
@ -114,6 +115,12 @@ var ConverterRFCTimeToString = NewDBTypeConverter[rfctime.Time, string](func(v r
return res, nil 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) { var ConverterJsonObjToString = NewDBTypeConverter[JsonObj, string](func(v JsonObj) (string, error) {
mrsh, err := json.Marshal(v) mrsh, err := json.Marshal(v)
if err != nil { if err != nil {

View File

@ -143,17 +143,22 @@ func (db *database) RegisterConverter(conv DBTypeConverter) {
func (db *database) RegisterDefaultConverter() { func (db *database) RegisterDefaultConverter() {
db.RegisterConverter(ConverterBoolToBit) db.RegisterConverter(ConverterBoolToBit)
db.RegisterConverter(ConverterTimeToUnixMillis) db.RegisterConverter(ConverterTimeToUnixMillis)
db.RegisterConverter(ConverterRFCUnixMilliTimeToUnixMillis) db.RegisterConverter(ConverterRFCUnixMilliTimeToUnixMillis)
db.RegisterConverter(ConverterRFCUnixNanoTimeToUnixNanos) db.RegisterConverter(ConverterRFCUnixNanoTimeToUnixNanos)
db.RegisterConverter(ConverterRFCUnixTimeToUnixSeconds) db.RegisterConverter(ConverterRFCUnixTimeToUnixSeconds)
db.RegisterConverter(ConverterRFC339TimeToString) db.RegisterConverter(ConverterRFC339TimeToString)
db.RegisterConverter(ConverterRFC339NanoTimeToString) db.RegisterConverter(ConverterRFC339NanoTimeToString)
db.RegisterConverter(ConverterRFCDateToString)
db.RegisterConverter(ConverterRFCTimeToString)
db.RegisterConverter(ConverterRFCSecondsF64ToString)
db.RegisterConverter(ConverterJsonObjToString) db.RegisterConverter(ConverterJsonObjToString)
db.RegisterConverter(ConverterJsonArrToString) db.RegisterConverter(ConverterJsonArrToString)
db.RegisterConverter(ConverterExErrCategoryToString) db.RegisterConverter(ConverterExErrCategoryToString)
db.RegisterConverter(ConverterExErrSeverityToString) db.RegisterConverter(ConverterExErrSeverityToString)
db.RegisterConverter(ConverterExErrTypeToString) db.RegisterConverter(ConverterExErrTypeToString)
db.RegisterConverter(ConverterRFCDateToString)
db.RegisterConverter(ConverterRFCTimeToString)
} }