summaryrefslogtreecommitdiffstats
path: root/vendor/go.mongodb.org/mongo-driver
diff options
context:
space:
mode:
authortechknowlogick <techknowlogick@gitea.io>2019-09-12 07:58:32 -0400
committerLauris BH <lauris.buksis@zzdats.lv>2019-09-12 14:58:32 +0300
commit3f5cdfe35905730ced41397c6ccd50df3804b5ec (patch)
treeb6319c3bdc863059594f20643c160551f5028f47 /vendor/go.mongodb.org/mongo-driver
parentd0ad47bd5d3cef8f743d39b379d83a0e5585c709 (diff)
downloadgitea-3f5cdfe35905730ced41397c6ccd50df3804b5ec.tar.gz
gitea-3f5cdfe35905730ced41397c6ccd50df3804b5ec.zip
use go 1.13 (#8088)
* use go 1.13 * use go 1.13 in gomod file * Update Makefile * update swagger deps
Diffstat (limited to 'vendor/go.mongodb.org/mongo-driver')
-rw-r--r--vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_codec.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_codec.go b/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_codec.go
index fe90272c06..56eeff94b1 100644
--- a/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_codec.go
+++ b/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_codec.go
@@ -10,6 +10,7 @@ import (
"errors"
"fmt"
"reflect"
+ "strings"
"sync"
"go.mongodb.org/mongo-driver/bson/bsonrw"
@@ -161,6 +162,13 @@ func (sc *StructCodec) DecodeValue(r DecodeContext, vr bsonrw.ValueReader, val r
fd, exists := sd.fm[name]
if !exists {
+ // if the original name isn't found in the struct description, try again with the name in lowercase
+ // this could match if a BSON tag isn't specified because by default, describeStruct lowercases all field
+ // names
+ fd, exists = sd.fm[strings.ToLower(name)]
+ }
+
+ if !exists {
if sd.inlineMap < 0 {
// The encoding/json package requires a flag to return on error for non-existent fields.
// This functionality seems appropriate for the struct codec.
@@ -195,7 +203,7 @@ func (sc *StructCodec) DecodeValue(r DecodeContext, vr bsonrw.ValueReader, val r
}
field = field.Addr()
- dctx := DecodeContext{Registry: r.Registry, Truncate: fd.truncate}
+ dctx := DecodeContext{Registry: r.Registry, Truncate: fd.truncate || r.Truncate}
if fd.decoder == nil {
return ErrNoDecoder{Type: field.Elem().Type()}
}