added mongo-driver v2
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m33s

This commit is contained in:
2026-04-21 18:41:32 +02:00
parent f62e7499ec
commit 26d542c9a2
33 changed files with 205 additions and 522 deletions
+12 -12
View File
@@ -5,14 +5,14 @@ import (
"encoding/json"
"errors"
"fmt"
"git.blackforestbytes.com/BlackForestBytes/goext/langext"
"github.com/rs/zerolog"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"math"
"strconv"
"strings"
"time"
"git.blackforestbytes.com/BlackForestBytes/goext/langext"
"github.com/rs/zerolog"
"go.mongodb.org/mongo-driver/v2/bson"
)
// This is a buffed up map[string]any
@@ -99,7 +99,7 @@ func (v MetaValue) SerializeValue() (string, error) {
case MDTBytes:
return hex.EncodeToString(v.Value.([]byte)), nil
case MDTObjectID:
return v.Value.(primitive.ObjectID).Hex(), nil
return v.Value.(bson.ObjectID).Hex(), nil
case MDTTime:
return strconv.FormatInt(v.Value.(time.Time).Unix(), 10) + "|" + strconv.FormatInt(int64(v.Value.(time.Time).Nanosecond()), 10), nil
case MDTDuration:
@@ -178,7 +178,7 @@ func (v MetaValue) ShortString(lim int) string {
case MDTBytes:
return langext.StrLimit(hex.EncodeToString(v.Value.([]byte)), lim, "...")
case MDTObjectID:
return v.Value.(primitive.ObjectID).Hex()
return v.Value.(bson.ObjectID).Hex()
case MDTTime:
return v.Value.(time.Time).Format(time.RFC3339)
case MDTDuration:
@@ -266,7 +266,7 @@ func (v MetaValue) Apply(key string, evt *zerolog.Event, limitLen *int) *zerolog
case MDTBytes:
return evt.Bytes(key, v.Value.([]byte))
case MDTObjectID:
return evt.Str(key, v.Value.(primitive.ObjectID).Hex())
return evt.Str(key, v.Value.(bson.ObjectID).Hex())
case MDTTime:
return evt.Time(key, v.Value.(time.Time))
case MDTDuration:
@@ -460,7 +460,7 @@ func (v *MetaValue) Deserialize(value string, datatype metaDataType) error {
v.DataType = datatype
return nil
case MDTObjectID:
r, err := primitive.ObjectIDFromHex(value)
r, err := bson.ObjectIDFromHex(value)
if err != nil {
return err
}
@@ -577,7 +577,7 @@ func (v MetaValue) ValueString() string {
case MDTBytes:
return hex.EncodeToString(v.Value.([]byte))
case MDTObjectID:
return v.Value.(primitive.ObjectID).Hex()
return v.Value.(bson.ObjectID).Hex()
case MDTTime:
return v.Value.(time.Time).Format(time.RFC3339Nano)
case MDTDuration:
@@ -628,8 +628,8 @@ func (v MetaValue) rawValueForJson() any {
if v.Value.(AnyWrap).IsError {
return bson.M{"@error": true}
}
jsonobj := primitive.M{}
jsonarr := primitive.A{}
jsonobj := bson.M{}
jsonarr := bson.A{}
if err := json.Unmarshal([]byte(v.Value.(AnyWrap).Json), &jsonobj); err == nil {
return jsonobj
} else if err := json.Unmarshal([]byte(v.Value.(AnyWrap).Json), &jsonarr); err == nil {
@@ -654,7 +654,7 @@ func (v MetaValue) rawValueForJson() any {
return v.Value.(time.Time).Format(time.RFC3339Nano)
}
if v.DataType == MDTObjectID {
return v.Value.(primitive.ObjectID).Hex()
return v.Value.(bson.ObjectID).Hex()
}
if v.DataType == MDTNil {
return nil