correct Pull method to break out of inner loop if a match is found
let's maybe not stop pulling elements after only the first one has been processed?
This commit is contained in:
parent
fcd7cb2013
commit
8b9720b70a
@ -172,12 +172,12 @@ func (d *Document) Pull(field string, a ...any) error {
|
|||||||
if fv.Kind() != reflect.Slice {
|
if fv.Kind() != reflect.Slice {
|
||||||
return ErrNotASlice
|
return ErrNotASlice
|
||||||
}
|
}
|
||||||
outer:
|
|
||||||
for _, b := range a {
|
for _, b := range a {
|
||||||
|
inner:
|
||||||
for i := 0; i < fv.Len(); i++ {
|
for i := 0; i < fv.Len(); i++ {
|
||||||
if reflect.DeepEqual(b, fv.Index(i).Interface()) {
|
if reflect.DeepEqual(b, fv.Index(i).Interface()) {
|
||||||
fv.Set(pull(fv, i, fv.Index(i).Type()))
|
fv.Set(pull(fv, i, fv.Index(i).Type()))
|
||||||
break outer
|
break inner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user