瀏覽代碼

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 年之前
父節點
當前提交
2bcf64d3dd
共有 1 個文件被更改,包括 1 次插入1 次删除
  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)