From 5a269325d1a83a0f022f516d8cc4591f0c9e1d4f Mon Sep 17 00:00:00 2001 From: rmweir Date: Thu, 20 Aug 2020 15:28:04 -0700 Subject: [PATCH] Differentiate between empty and nil arrays Prior, empty array were converted to nil. In some cases the difference between a nil and empty array are not arbitrary. Now, empty arrays will be converted to empty interface arrays and nil array will be converted to nil interface arrays. --- parse/builder/builder.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/parse/builder/builder.go b/parse/builder/builder.go index 38084fc8..f27b09e3 100644 --- a/parse/builder/builder.go +++ b/parse/builder/builder.go @@ -447,6 +447,10 @@ func (b *Builder) convertArray(fieldType string, value interface{}, op Operation } var result []interface{} + if value == nil { + return result, nil + } + result = make([]interface{}, 0) subType := definition.SubType(fieldType) for _, value := range sliceValue {