updated dependencies and go

This commit is contained in:
2026-04-21 11:06:01 +02:00
parent f62e7499ec
commit 84b87d61f2
91 changed files with 551 additions and 637 deletions
+3 -3
View File
@@ -2,11 +2,11 @@ package wmo
import (
"context"
"go.mongodb.org/mongo-driver/bson/bsontype"
"go.mongodb.org/mongo-driver/mongo"
ct "git.blackforestbytes.com/BlackForestBytes/goext/cursortoken"
"git.blackforestbytes.com/BlackForestBytes/goext/exerr"
"git.blackforestbytes.com/BlackForestBytes/goext/langext"
"go.mongodb.org/mongo-driver/bson/bsontype"
"go.mongodb.org/mongo-driver/mongo"
"reflect"
)
@@ -80,7 +80,7 @@ func (c *Coll[TData]) WithDecodeFunc(cdf func(ctx context.Context, dec Decodable
c.EnsureInitializedReflection(example)
c.customDecoder = langext.Ptr(cdf)
c.customDecoder = new(cdf)
return c
}
+3 -3
View File
@@ -2,10 +2,10 @@ package wmo
import (
"context"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"git.blackforestbytes.com/BlackForestBytes/goext/exerr"
"git.blackforestbytes.com/BlackForestBytes/goext/langext"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
)
func (c *Coll[TData]) InsertOne(ctx context.Context, valueIn TData) (TData, error) {
@@ -41,7 +41,7 @@ func (c *Coll[TData]) InsertOneUnchecked(ctx context.Context, valueIn any) (TDat
func (c *Coll[TData]) InsertMany(ctx context.Context, valueIn []TData) (*mongo.InsertManyResult, error) {
for _, hook := range c.marshalHooks {
for i := 0; i < len(valueIn); i++ {
for i := range valueIn {
valueIn[i] = hook(valueIn[i])
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ func (c *Coll[TData]) init() {
example := *new(TData)
datatype := reflect.TypeOf(&example).Elem()
datatype := reflect.TypeFor[TData]()
if datatype.Kind() == reflect.Interface {
+5 -7
View File
@@ -6,7 +6,6 @@ import (
"testing"
"time"
"git.blackforestbytes.com/BlackForestBytes/goext/langext"
"git.blackforestbytes.com/BlackForestBytes/goext/rfctime"
"git.blackforestbytes.com/BlackForestBytes/goext/timeext"
"git.blackforestbytes.com/BlackForestBytes/goext/tst"
@@ -54,7 +53,7 @@ func TestReflectionGetFieldType(t *testing.T) {
A: "4",
},
Str: "3",
Ptr: langext.Ptr(4),
Ptr: new(4),
MDate: t1,
ODate: nil,
}
@@ -208,7 +207,7 @@ func TestReflectionGetFieldValueAsTokenString(t *testing.T) {
A: "2",
},
Str: "3",
Ptr: langext.Ptr(4),
Ptr: new(4),
Num: 22,
FFF: 22.5,
Ptr2: nil,
@@ -239,8 +238,7 @@ func TestReflectionWithInterface(t *testing.T) {
CDate time.Time `bson:"cdate"`
}
type TestInterface interface {
}
type TestInterface any
coll1 := W[TestInterface](&mongo.Collection{})
@@ -256,6 +254,6 @@ func TestReflectionWithInterface(t *testing.T) {
tst.AssertTrue(t, coll2.coll != nil)
tst.AssertEqual(t, 1, len(coll2.implDataTypeMap))
tst.AssertEqual(t, "ID", coll2.implDataTypeMap[reflect.TypeOf(TestData{})]["_id"].Name)
tst.AssertEqual(t, "CDate", coll2.implDataTypeMap[reflect.TypeOf(TestData{})]["cdate"].Name)
tst.AssertEqual(t, "ID", coll2.implDataTypeMap[reflect.TypeFor[TestData]()]["_id"].Name)
tst.AssertEqual(t, "CDate", coll2.implDataTypeMap[reflect.TypeFor[TestData]()]["cdate"].Name)
}