Browse Source

marshalUDT: allow not using all the UDT fields

When inserting a UDT via a map, allow the map to be a subset of the UDT.

Fixes #841
Chris Bannister 9 năm trước cách đây
mục cha
commit
2bcf64d3dd
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      marshal.go

+ 1 - 1
marshal.go

@@ -1590,7 +1590,7 @@ func marshalUDT(info TypeInfo, value interface{}) ([]byte, error) {
 		for _, e := range udt.Elements {
 			val, ok := v[e.Name]
 			if !ok {
-				return nil, marshalErrorf("missing UDT field in map: %s", e.Name)
+				continue
 			}
 
 			data, err := Marshal(e.Type, val)