mirror of
https://github.com/mainnika/mongox-go-driver.git
synced 2026-05-22 15:53:36 +00:00
Prepare for v3
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package docbased
|
||||
|
||||
import (
|
||||
"github.com/modern-go/reflect2"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox"
|
||||
)
|
||||
|
||||
var _ mongox.DocBased = (*Primary)(nil)
|
||||
|
||||
// Primary is a structure with object as an _id field
|
||||
type Primary struct {
|
||||
ID primitive.D `bson:"_id" json:"_id"`
|
||||
}
|
||||
|
||||
// GetID returns an _id
|
||||
func (p *Primary) GetID() (id primitive.D) {
|
||||
return p.ID
|
||||
}
|
||||
|
||||
// SetID sets an _id
|
||||
func (p *Primary) SetID(id primitive.D) {
|
||||
p.ID = id
|
||||
}
|
||||
|
||||
// New creates a new Primary structure with a defined _id
|
||||
func New(e primitive.E, ee ...primitive.E) Primary {
|
||||
id := primitive.D{e}
|
||||
if len(ee) > 0 {
|
||||
id = append(id, ee...)
|
||||
}
|
||||
|
||||
return Primary{ID: id}
|
||||
}
|
||||
|
||||
func GetID(source mongox.DocBased) (id primitive.D, err error) {
|
||||
id = source.GetID()
|
||||
if !reflect2.IsNil(id) {
|
||||
return id, nil
|
||||
}
|
||||
|
||||
return nil, mongox.ErrUninitializedBase
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package jsonbased_test
|
||||
package docbased_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -8,27 +8,25 @@ import (
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox-testing/database"
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/base/jsonbased"
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/base/docbased"
|
||||
)
|
||||
|
||||
func Test_GetID(t *testing.T) {
|
||||
|
||||
type DocWithObject struct {
|
||||
jsonbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
docbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
}
|
||||
|
||||
doc := &DocWithObject{Primary: jsonbased.Primary{ID: primitive.D{{"1", "one"}, {"2", "two"}}}}
|
||||
doc := &DocWithObject{Primary: docbased.New(primitive.E{"1", "one"}, primitive.E{"2", "two"})}
|
||||
|
||||
assert.Equal(t, primitive.D{{"1", "one"}, {"2", "two"}}, doc.GetID())
|
||||
}
|
||||
|
||||
func Test_SetID(t *testing.T) {
|
||||
|
||||
type DocWithObject struct {
|
||||
jsonbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
docbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
}
|
||||
|
||||
doc := &DocWithObject{Primary: jsonbased.Primary{ID: primitive.D{{"1", "one"}, {"2", "two"}}}}
|
||||
doc := &DocWithObject{Primary: docbased.New(primitive.E{"1", "one"}, primitive.E{"2", "two"})}
|
||||
|
||||
doc.SetID(primitive.D{{"3", "three"}, {"4", "you"}})
|
||||
|
||||
@@ -37,9 +35,8 @@ func Test_SetID(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_SaveLoad(t *testing.T) {
|
||||
|
||||
type DocWithObjectID struct {
|
||||
jsonbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
docbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
}
|
||||
|
||||
db, err := database.NewEphemeral("")
|
||||
@@ -47,9 +44,9 @@ func Test_SaveLoad(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
defer db.Close()
|
||||
defer func() { _ = db.Close() }()
|
||||
|
||||
doc1 := &DocWithObjectID{Primary: jsonbased.Primary{ID: primitive.D{{"1", "one"}, {"2", "two"}}}}
|
||||
doc1 := &DocWithObjectID{Primary: docbased.New(primitive.E{"1", "one"}, primitive.E{"2", "two"})}
|
||||
doc2 := &DocWithObjectID{}
|
||||
|
||||
err = db.SaveOne(doc1)
|
||||
@@ -67,12 +64,11 @@ func Test_SaveLoad(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_Marshal(t *testing.T) {
|
||||
|
||||
type DocWithObjectID struct {
|
||||
jsonbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
docbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
}
|
||||
|
||||
doc := &DocWithObjectID{Primary: jsonbased.Primary{ID: primitive.D{{"1", "one"}, {"2", "two"}}}}
|
||||
doc := &DocWithObjectID{Primary: docbased.New(primitive.E{"1", "one"}, primitive.E{"2", "two"})}
|
||||
|
||||
bytes, err := json.Marshal(doc)
|
||||
assert.NoError(t, err)
|
||||
+11
-55
@@ -2,70 +2,26 @@ package base
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/modern-go/reflect2"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/base/docbased"
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/base/ifacebased"
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/base/oidbased"
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/base/stringbased"
|
||||
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox"
|
||||
)
|
||||
|
||||
// GetID returns source document id
|
||||
func GetID(source interface{}) (id interface{}) {
|
||||
|
||||
func GetID(source interface{}) (id interface{}, err error) {
|
||||
switch doc := source.(type) {
|
||||
case mongox.OIDBased:
|
||||
return getObjectIDOrGenerate(doc)
|
||||
return oidbased.GetID(doc)
|
||||
case mongox.StringBased:
|
||||
return getStringIDOrPanic(doc)
|
||||
case mongox.JSONBased:
|
||||
return getObjectOrPanic(doc)
|
||||
return stringbased.GetID(doc)
|
||||
case mongox.DocBased:
|
||||
return docbased.GetID(doc)
|
||||
case mongox.InterfaceBased:
|
||||
return getInterfaceOrPanic(doc)
|
||||
|
||||
return ifacebased.GetID(doc)
|
||||
default:
|
||||
panic(fmt.Errorf("source contains malformed document, %v", source))
|
||||
return nil, fmt.Errorf("%w: unknown base type", mongox.ErrMalformedBase)
|
||||
}
|
||||
}
|
||||
|
||||
func getObjectIDOrGenerate(source mongox.OIDBased) (id primitive.ObjectID) {
|
||||
|
||||
id = source.GetID()
|
||||
if id != primitive.NilObjectID {
|
||||
return id
|
||||
}
|
||||
|
||||
id = primitive.NewObjectID()
|
||||
source.SetID(id)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func getStringIDOrPanic(source mongox.StringBased) (id string) {
|
||||
|
||||
id = source.GetID()
|
||||
if id != "" {
|
||||
return id
|
||||
}
|
||||
|
||||
panic(fmt.Errorf("source contains malformed document, %v", source))
|
||||
}
|
||||
|
||||
func getObjectOrPanic(source mongox.JSONBased) (id primitive.D) {
|
||||
|
||||
id = source.GetID()
|
||||
if id != nil {
|
||||
return id
|
||||
}
|
||||
|
||||
panic(fmt.Errorf("source contains malformed document, %v", source))
|
||||
}
|
||||
|
||||
func getInterfaceOrPanic(source mongox.InterfaceBased) (id interface{}) {
|
||||
|
||||
id = source.GetID()
|
||||
if !reflect2.IsNil(id) {
|
||||
return id
|
||||
}
|
||||
|
||||
panic(fmt.Errorf("source contains malformed document, %v", source))
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package base_test
|
||||
|
||||
import (
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/base/docbased"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/base"
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/base/jsonbased"
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/base/oidbased"
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/base/stringbased"
|
||||
)
|
||||
@@ -29,15 +30,24 @@ func TestGetID(t *testing.T) {
|
||||
type DocWithObjectID struct {
|
||||
oidbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
}
|
||||
id, err := base.GetID(&DocWithObjectID{Primary: oidbased.Primary{ID: [12]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2}}})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, primitive.ObjectID([12]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2}), id)
|
||||
|
||||
type DocWithObject struct {
|
||||
jsonbased.Primary `bson:",inline" json:",inline" collection:"2"`
|
||||
docbased.Primary `bson:",inline" json:",inline" collection:"2"`
|
||||
}
|
||||
id, err = base.GetID(&DocWithObject{Primary: docbased.Primary{ID: primitive.D{{"1", "2"}}}})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, primitive.D{{"1", "2"}}, id)
|
||||
|
||||
type DocWithString struct {
|
||||
stringbased.Primary `bson:",inline" json:",inline" collection:"3"`
|
||||
}
|
||||
id, err = base.GetID(&DocWithString{Primary: stringbased.Primary{ID: "foobar"}})
|
||||
assert.Equal(t, "foobar", id)
|
||||
|
||||
assert.Equal(t, primitive.ObjectID([12]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2}), base.GetID(&DocWithObjectID{Primary: oidbased.Primary{ID: [12]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2}}}))
|
||||
assert.Equal(t, primitive.D{{"1", "2"}}, base.GetID(&DocWithObject{Primary: jsonbased.Primary{ID: primitive.D{{"1", "2"}}}}))
|
||||
assert.Equal(t, "foobar", base.GetID(&DocWithString{Primary: stringbased.Primary{ID: "foobar"}}))
|
||||
assert.Equal(t, 420, base.GetID(&DocWithCustomInterface{ID: 420}))
|
||||
id, err = base.GetID(&DocWithCustomInterface{ID: 420})
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 420, id)
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package base
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/base/protection"
|
||||
)
|
||||
|
||||
// GetProtection function finds protection field in the source document otherwise returns nil
|
||||
func GetProtection(source interface{}) (key *protection.Key) {
|
||||
|
||||
v := reflect.ValueOf(source)
|
||||
if v.Kind() != reflect.Ptr || v.IsNil() {
|
||||
return
|
||||
}
|
||||
|
||||
el := v.Elem()
|
||||
numField := el.NumField()
|
||||
|
||||
for i := 0; i < numField; i++ {
|
||||
field := el.Field(i)
|
||||
if !field.CanInterface() {
|
||||
continue
|
||||
}
|
||||
|
||||
switch field.Interface().(type) {
|
||||
case *protection.Key:
|
||||
key = field.Interface().(*protection.Key)
|
||||
case protection.Key:
|
||||
ptr := field.Addr()
|
||||
key = ptr.Interface().(*protection.Key)
|
||||
default:
|
||||
continue
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package ifacebased
|
||||
|
||||
import (
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox"
|
||||
"github.com/modern-go/reflect2"
|
||||
)
|
||||
|
||||
// GetID returns an _id from the source document
|
||||
func GetID(source mongox.InterfaceBased) (id interface{}, err error) {
|
||||
id = source.GetID()
|
||||
if !reflect2.IsNil(id) {
|
||||
return id, nil
|
||||
}
|
||||
|
||||
return nil, mongox.ErrUninitializedBase
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package jsonbased
|
||||
|
||||
import (
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox"
|
||||
)
|
||||
|
||||
var _ mongox.JSONBased = (*Primary)(nil)
|
||||
|
||||
// Primary is a structure with object as an _id field
|
||||
type Primary struct {
|
||||
ID primitive.D `bson:"_id" json:"_id"`
|
||||
}
|
||||
|
||||
// GetID returns an _id
|
||||
func (p *Primary) GetID() (id primitive.D) {
|
||||
return p.ID
|
||||
}
|
||||
|
||||
// SetID sets an _id
|
||||
func (p *Primary) SetID(id primitive.D) {
|
||||
p.ID = id
|
||||
}
|
||||
@@ -22,3 +22,22 @@ func (p *Primary) GetID() (id primitive.ObjectID) {
|
||||
func (p *Primary) SetID(id primitive.ObjectID) {
|
||||
p.ID = id
|
||||
}
|
||||
|
||||
// Generate creates a new Primary structure with a new objectId
|
||||
func Generate() Primary {
|
||||
return Primary{ID: primitive.NewObjectID()}
|
||||
}
|
||||
|
||||
// New creates a new Primary structure with a defined objectId
|
||||
func New(id primitive.ObjectID) Primary {
|
||||
return Primary{ID: id}
|
||||
}
|
||||
|
||||
func GetID(source mongox.OIDBased) (id primitive.ObjectID, err error) {
|
||||
id = source.GetID()
|
||||
if id != primitive.NilObjectID {
|
||||
return id, nil
|
||||
}
|
||||
|
||||
return primitive.NilObjectID, mongox.ErrUninitializedBase
|
||||
}
|
||||
|
||||
@@ -12,24 +12,22 @@ import (
|
||||
)
|
||||
|
||||
func Test_GetID(t *testing.T) {
|
||||
|
||||
type DocWithObjectID struct {
|
||||
oidbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
}
|
||||
|
||||
doc := &DocWithObjectID{Primary: oidbased.Primary{ID: [12]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2}}}
|
||||
doc := &DocWithObjectID{Primary: oidbased.New([12]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2})}
|
||||
|
||||
assert.Equal(t, primitive.ObjectID([12]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2}), doc.Primary.ID)
|
||||
assert.Equal(t, primitive.ObjectID([12]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2}), doc.GetID())
|
||||
}
|
||||
|
||||
func Test_SetID(t *testing.T) {
|
||||
|
||||
type DocWithObjectID struct {
|
||||
oidbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
}
|
||||
|
||||
doc := &DocWithObjectID{}
|
||||
|
||||
doc := &DocWithObjectID{Primary: oidbased.Generate()}
|
||||
doc.SetID([12]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2})
|
||||
|
||||
assert.Equal(t, primitive.ObjectID([12]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2}), doc.Primary.ID)
|
||||
@@ -37,7 +35,6 @@ func Test_SetID(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_SaveLoad(t *testing.T) {
|
||||
|
||||
type DocWithObjectID struct {
|
||||
oidbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
}
|
||||
@@ -47,10 +44,10 @@ func Test_SaveLoad(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
defer db.Close()
|
||||
defer func() { _ = db.Close() }()
|
||||
|
||||
doc1 := &DocWithObjectID{}
|
||||
doc2 := &DocWithObjectID{}
|
||||
doc1 := &DocWithObjectID{Primary: oidbased.Generate()}
|
||||
doc2 := &DocWithObjectID{Primary: oidbased.Generate()}
|
||||
|
||||
err = db.SaveOne(doc1)
|
||||
assert.NoError(t, err)
|
||||
@@ -67,13 +64,12 @@ func Test_SaveLoad(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_Marshal(t *testing.T) {
|
||||
|
||||
type DocWithObjectID struct {
|
||||
oidbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
}
|
||||
|
||||
id, _ := primitive.ObjectIDFromHex("feadbeeffeadbeeffeadbeef")
|
||||
doc := &DocWithObjectID{Primary: oidbased.Primary{ID: id}}
|
||||
doc := &DocWithObjectID{Primary: oidbased.New(id)}
|
||||
|
||||
bytes, err := json.Marshal(doc)
|
||||
assert.NoError(t, err)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package protection
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/modern-go/reflect2"
|
||||
@@ -13,9 +14,8 @@ type Key struct {
|
||||
V int64 `bson:"_v" json:"_v"`
|
||||
}
|
||||
|
||||
// PutToDocument extends the doc with protection key values
|
||||
func (k *Key) PutToDocument(doc primitive.M) {
|
||||
|
||||
// Inject extends the doc with protection key values
|
||||
func (k *Key) Inject(doc primitive.M) {
|
||||
if reflect2.IsNil(doc) {
|
||||
return
|
||||
}
|
||||
@@ -34,3 +34,35 @@ func (k *Key) Restate() {
|
||||
k.X = primitive.NewObjectID()
|
||||
k.V = time.Now().Unix()
|
||||
}
|
||||
|
||||
// Get finds protection field in the source document otherwise returns nil
|
||||
func Get(source interface{}) (key *Key) {
|
||||
v := reflect.ValueOf(source)
|
||||
if v.Kind() != reflect.Ptr || v.IsNil() {
|
||||
return nil
|
||||
}
|
||||
|
||||
el := v.Elem()
|
||||
numField := el.NumField()
|
||||
|
||||
for i := 0; i < numField; i++ {
|
||||
field := el.Field(i)
|
||||
if !field.CanInterface() {
|
||||
continue
|
||||
}
|
||||
|
||||
switch field.Interface().(type) {
|
||||
case *Key:
|
||||
key = field.Interface().(*Key)
|
||||
case Key:
|
||||
ptr := field.Addr()
|
||||
key = ptr.Interface().(*Key)
|
||||
default:
|
||||
continue
|
||||
}
|
||||
|
||||
return key
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package protection_test
|
||||
|
||||
// TODO:
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
|
||||
// Reset function creates new zero object for the target pointer
|
||||
func Reset(target interface{}) (created bool) {
|
||||
|
||||
type resetter interface {
|
||||
Reset()
|
||||
}
|
||||
|
||||
@@ -20,3 +20,17 @@ func (p *Primary) GetID() (id string) {
|
||||
func (p *Primary) SetID(id string) {
|
||||
p.ID = id
|
||||
}
|
||||
|
||||
// New creates a new Primary structure with a defined _id
|
||||
func New(id string) Primary {
|
||||
return Primary{ID: id}
|
||||
}
|
||||
|
||||
func GetID(source mongox.StringBased) (id string, err error) {
|
||||
id = source.GetID()
|
||||
if id != "" {
|
||||
return id, nil
|
||||
}
|
||||
|
||||
return "", mongox.ErrUninitializedBase
|
||||
}
|
||||
|
||||
@@ -11,23 +11,21 @@ import (
|
||||
)
|
||||
|
||||
func Test_GetID(t *testing.T) {
|
||||
|
||||
type DocWithString struct {
|
||||
stringbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
}
|
||||
|
||||
doc := &DocWithString{Primary: stringbased.Primary{ID: "foobar"}}
|
||||
doc := &DocWithString{Primary: stringbased.New("foobar")}
|
||||
|
||||
assert.Equal(t, "foobar", doc.GetID())
|
||||
}
|
||||
|
||||
func Test_SetID(t *testing.T) {
|
||||
|
||||
type DocWithString struct {
|
||||
stringbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
}
|
||||
|
||||
doc := &DocWithString{Primary: stringbased.Primary{ID: "foobar"}}
|
||||
doc := &DocWithString{Primary: stringbased.New("foobar")}
|
||||
|
||||
doc.SetID("rockrockrock")
|
||||
|
||||
@@ -36,7 +34,6 @@ func Test_SetID(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_SaveLoad(t *testing.T) {
|
||||
|
||||
type DocWithObjectID struct {
|
||||
stringbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
}
|
||||
@@ -46,9 +43,9 @@ func Test_SaveLoad(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
defer db.Close()
|
||||
defer func() { _ = db.Close() }()
|
||||
|
||||
doc1 := &DocWithObjectID{Primary: stringbased.Primary{ID: "foobar"}}
|
||||
doc1 := &DocWithObjectID{Primary: stringbased.New("foobar")}
|
||||
doc2 := &DocWithObjectID{}
|
||||
|
||||
err = db.SaveOne(doc1)
|
||||
@@ -66,12 +63,11 @@ func Test_SaveLoad(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_Marshal(t *testing.T) {
|
||||
|
||||
type DocWithObjectID struct {
|
||||
stringbased.Primary `bson:",inline" json:",inline" collection:"1"`
|
||||
}
|
||||
|
||||
doc := &DocWithObjectID{Primary: stringbased.Primary{ID: "foobar"}}
|
||||
doc := &DocWithObjectID{Primary: stringbased.New("foobar")}
|
||||
|
||||
bytes, err := json.Marshal(doc)
|
||||
assert.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user