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:
@@ -4,7 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.blackforestbytes.com/BlackForestBytes/goext/langext"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -28,7 +28,7 @@ var primitiveSerializer = map[reflect.Type]genSerializer{
|
||||
|
||||
reflect.TypeFor[bool](): newGenSerializer(serBoolToString, serStringToBool),
|
||||
|
||||
reflect.TypeFor[primitive.ObjectID](): newGenSerializer(serObjectIDToString, serStringToObjectID),
|
||||
reflect.TypeFor[bson.ObjectID](): newGenSerializer(serObjectIDToString, serStringToObjectID),
|
||||
|
||||
reflect.TypeFor[time.Time](): newGenSerializer(serTimeToString, serStringToTime),
|
||||
}
|
||||
@@ -111,15 +111,15 @@ func serStringToBool(v string) (bool, error) {
|
||||
return false, errors.New(fmt.Sprintf("invalid boolean value '%s'", v))
|
||||
}
|
||||
|
||||
func serObjectIDToString(v primitive.ObjectID) (string, error) {
|
||||
func serObjectIDToString(v bson.ObjectID) (string, error) {
|
||||
return v.Hex(), nil
|
||||
}
|
||||
|
||||
func serStringToObjectID(v string) (primitive.ObjectID, error) {
|
||||
if rv, err := primitive.ObjectIDFromHex(v); err == nil {
|
||||
func serStringToObjectID(v string) (bson.ObjectID, error) {
|
||||
if rv, err := bson.ObjectIDFromHex(v); err == nil {
|
||||
return rv, nil
|
||||
} else {
|
||||
return primitive.ObjectID{}, err
|
||||
return bson.ObjectID{}, err
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user