Skip to content

Commit

Permalink
apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
fredcarle committed Sep 2, 2022
1 parent 43f8e0b commit e4840fa
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions db/collection_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func validateFieldSchema(val *fastjson.Value, field client.FieldDescription) (in
return getString(val)

case client.FieldKind_STRING_ARRAY:
return getArray(val, getString, "")
return getArray(val, getString)

case client.FieldKind_NILLABLE_STRING_ARRAY:
return getNillableArray(val, getString)
Expand All @@ -440,7 +440,7 @@ func validateFieldSchema(val *fastjson.Value, field client.FieldDescription) (in
return getBool(val)

case client.FieldKind_BOOL_ARRAY:
return getArray(val, getBool, false)
return getArray(val, getBool)

case client.FieldKind_NILLABLE_BOOL_ARRAY:
return getNillableArray(val, getBool)
Expand All @@ -449,7 +449,7 @@ func validateFieldSchema(val *fastjson.Value, field client.FieldDescription) (in
return getFloat64(val)

case client.FieldKind_FLOAT_ARRAY:
return getArray(val, getFloat64, 0)
return getArray(val, getFloat64)

case client.FieldKind_NILLABLE_FLOAT_ARRAY:
return getNillableArray(val, getFloat64)
Expand All @@ -461,7 +461,7 @@ func validateFieldSchema(val *fastjson.Value, field client.FieldDescription) (in
return getInt64(val)

case client.FieldKind_INT_ARRAY:
return getArray(val, getInt64, 0)
return getArray(val, getInt64)

case client.FieldKind_NILLABLE_INT_ARRAY:
return getNillableArray(val, getInt64)
Expand Down Expand Up @@ -502,7 +502,6 @@ func getDate(v *fastjson.Value) (time.Time, error) {
func getArray[T any](
val *fastjson.Value,
typeGetter func(*fastjson.Value) (T, error),
zeroValue T,
) ([]T, error) {
if val.Type() == fastjson.TypeNull {
return nil, nil
Expand All @@ -516,7 +515,6 @@ func getArray[T any](
arr := make([]T, len(valArray))
for i, arrItem := range valArray {
if arrItem.Type() == fastjson.TypeNull {
arr[i] = zeroValue
continue
}
arr[i], err = typeGetter(arrItem)
Expand Down

0 comments on commit e4840fa

Please sign in to comment.