Upgrade dependent version: go.mongodb.org/mongo-driver (#5320)
Upgrade dependent version: go.mongodb.org/mongo-driver v1.3.2 -> v1.10.4 Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io> Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>
This commit is contained in:
23
vendor/go.mongodb.org/mongo-driver/bson/decoder.go
generated
vendored
23
vendor/go.mongodb.org/mongo-driver/bson/decoder.go
generated
vendored
@@ -33,6 +33,11 @@ var decPool = sync.Pool{
|
||||
type Decoder struct {
|
||||
dc bsoncodec.DecodeContext
|
||||
vr bsonrw.ValueReader
|
||||
|
||||
// We persist defaultDocumentM and defaultDocumentD on the Decoder to prevent overwriting from
|
||||
// (*Decoder).SetContext.
|
||||
defaultDocumentM bool
|
||||
defaultDocumentD bool
|
||||
}
|
||||
|
||||
// NewDecoder returns a new decoder that uses the DefaultRegistry to read from vr.
|
||||
@@ -95,6 +100,12 @@ func (d *Decoder) Decode(val interface{}) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if d.defaultDocumentM {
|
||||
d.dc.DefaultDocumentM()
|
||||
}
|
||||
if d.defaultDocumentD {
|
||||
d.dc.DefaultDocumentD()
|
||||
}
|
||||
return decoder.DecodeValue(d.dc, d.vr, rval)
|
||||
}
|
||||
|
||||
@@ -116,3 +127,15 @@ func (d *Decoder) SetContext(dc bsoncodec.DecodeContext) error {
|
||||
d.dc = dc
|
||||
return nil
|
||||
}
|
||||
|
||||
// DefaultDocumentM will decode empty documents using the primitive.M type. This behavior is restricted to data typed as
|
||||
// "interface{}" or "map[string]interface{}".
|
||||
func (d *Decoder) DefaultDocumentM() {
|
||||
d.defaultDocumentM = true
|
||||
}
|
||||
|
||||
// DefaultDocumentD will decode empty documents using the primitive.D type. This behavior is restricted to data typed as
|
||||
// "interface{}" or "map[string]interface{}".
|
||||
func (d *Decoder) DefaultDocumentD() {
|
||||
d.defaultDocumentD = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user