updated mongo driver dependencies to v2
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m27s
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m27s
This commit is contained in:
+9
-10
@@ -7,8 +7,7 @@ import (
|
||||
"fmt"
|
||||
"git.blackforestbytes.com/BlackForestBytes/goext/langext"
|
||||
"github.com/rs/zerolog"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -99,7 +98,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 +177,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 +265,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 +459,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 +576,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 +627,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 +653,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
|
||||
|
||||
Reference in New Issue
Block a user