Skip to content

Commit

Permalink
fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
halfcrazy committed Jan 2, 2024
1 parent 219c10b commit 518c281
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,13 @@ func (a api) List(ctx context.Context, result interface{}) error {
if err != nil {
return err
}
if resultVal.IsNil() || resultVal.Cap() == 0 {
resultVal.Set(reflect.MakeSlice(resultVal.Type(), 0, len(rows)))
}
} else {
rows = tableCache.Rows()
// If given a null slice, fill it in the cache table completely, if not, just up to
// its capability.
if resultVal.IsNil() || resultVal.Cap() == 0 {
resultVal.Set(reflect.MakeSlice(resultVal.Type(), 0, tableCache.Len()))
}
}
// If given a null slice, fill it in the cache table completely, if not, just up to
// its capability.
if resultVal.IsNil() || resultVal.Cap() == 0 {
resultVal.Set(reflect.MakeSlice(resultVal.Type(), 0, len(rows)))
}
i := resultVal.Len()
maxCap := resultVal.Cap()
Expand Down

0 comments on commit 518c281

Please sign in to comment.