Skip to content

Commit

Permalink
Revert "fix(datastore): Handling nil slices in save and query (#8043)" (
Browse files Browse the repository at this point in the history
#8086)

This reverts commit 36f01e9.
  • Loading branch information
bhshkh committed Jun 13, 2023
1 parent c9b272b commit 39f9c9d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 22 deletions.
5 changes: 0 additions & 5 deletions datastore/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,6 @@ func (l *propertyLoader) loadOneElement(codec fields.List, structValue reflect.V
structValue = v
}

if v.Kind() == reflect.Slice && p.Value == nil {
v.Set(reflect.Zero(v.Type()))
return ""
}

// If the element is a slice, we need to accommodate it.
if v.Kind() == reflect.Slice && v.Type() != typeOfByteSlice {
if l.m == nil {
Expand Down
12 changes: 0 additions & 12 deletions datastore/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,18 +316,6 @@ func TestLoadEntityNested(t *testing.T) {
A: []Simple{{I: 3}, {I: 4}},
},
},
{
desc: "nested simple with nil slice",
src: &pb.Entity{
Properties: map[string]*pb.Value{
"A": {ValueType: &pb.Value_NullValue{}},
},
},

want: &NestedSliceOfSimple{
A: nil,
},
},
{
desc: "nested with multiple anonymous fields",
src: &pb.Entity{
Expand Down
5 changes: 0 additions & 5 deletions datastore/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,6 @@ func (s structPLS) key(v reflect.Value) (*Key, error) {
func saveSliceProperty(props *[]Property, name string, opts saveOpts, v reflect.Value) error {
// Easy case: if the slice is empty, we're done.
if v.Len() == 0 {
*props = append(*props, Property{
Name: name,
Value: nil,
NoIndex: opts.noIndex,
})
return nil
}
// Work out the properties generated by the first element in the slice. This will
Expand Down

0 comments on commit 39f9c9d

Please sign in to comment.