|
|
@ -51,17 +51,18 @@ func (d *Database) LoadArray(target interface{}, filters ...interface{}) (err er |
|
|
|
for i = 0; result.Next(d.Context()); { |
|
|
|
for i = 0; result.Next(d.Context()); { |
|
|
|
if targetSliceV.Len() == i { |
|
|
|
if targetSliceV.Len() == i { |
|
|
|
elem := reflect.New(targetSliceElemT.Elem()) |
|
|
|
elem := reflect.New(targetSliceElemT.Elem()) |
|
|
|
if err = result.Decode(elem.Interface()); err == nil { |
|
|
|
err = result.Decode(elem.Interface()) |
|
|
|
|
|
|
|
if err == nil { |
|
|
|
targetSliceV = reflect.Append(targetSliceV, elem) |
|
|
|
targetSliceV = reflect.Append(targetSliceV, elem) |
|
|
|
} else { |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
elem := targetSliceV.Index(i).Interface() |
|
|
|
elem := targetSliceV.Index(i).Interface() |
|
|
|
base.Reset(elem) |
|
|
|
base.Reset(elem) |
|
|
|
if err = result.Decode(elem); err != nil { |
|
|
|
err = result.Decode(elem) |
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
_ = result.Close(d.Context()) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
i++ |
|
|
|
i++ |
|
|
|