Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
422bbd8593
|
|||
3956675e04
|
4
go.mod
4
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
|
||||
@@ -23,7 +23,7 @@ require (
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.18.0 // indirect
|
||||
github.com/go-playground/validator/v10 v10.19.0 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/uuid v1.5.0 // indirect
|
||||
|
4
go.sum
4
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=
|
||||
@@ -39,6 +41,8 @@ github.com/go-playground/validator/v10 v10.17.0 h1:SmVVlfAOtlZncTxRuinDPomC2DkXJ
|
||||
github.com/go-playground/validator/v10 v10.17.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
||||
github.com/go-playground/validator/v10 v10.18.0 h1:BvolUXjp4zuvkZ5YN5t7ebzbhlUtPsPm2S9NAZ5nl9U=
|
||||
github.com/go-playground/validator/v10 v10.18.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||
github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4=
|
||||
github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
|
||||
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
|
@@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.395"
|
||||
const GoextVersion = "0.0.397"
|
||||
|
||||
const GoextVersionTimestamp = "2024-02-27T13:42:06+0100"
|
||||
const GoextVersionTimestamp = "2024-03-04T12:17:10+0100"
|
||||
|
@@ -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 {
|
||||
|
@@ -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)
|
||||
}
|
||||
|
@@ -38,6 +38,13 @@ type fullTypeRef struct {
|
||||
Index []int
|
||||
}
|
||||
|
||||
type IColl interface {
|
||||
Collection() *mongo.Collection
|
||||
Name() string
|
||||
Indexes() mongo.IndexView
|
||||
Drop(ctx context.Context) error
|
||||
}
|
||||
|
||||
type Coll[TData any] struct {
|
||||
coll *mongo.Collection // internal mongo collection, access via Collection()
|
||||
dataTypeMap map[string]fullTypeRef // list of TData fields (only if TData is not an interface)
|
||||
|
Reference in New Issue
Block a user