Fix Params case handling in where with slices of structs (e.g. Pages)

Fixes #7009
This commit is contained in:
Bjørn Erik Pedersen
2021-04-21 09:08:42 +02:00
parent 057e5a22af
commit bca40cf0c9
2 changed files with 28 additions and 1 deletions

View File

@@ -382,12 +382,21 @@ func (ns *Namespace) checkWhereArray(seqv, kv, mv reflect.Value, path []string,
vvv = reflect.ValueOf(params.Get(path...))
} else {
vvv = rvv
for _, elemName := range path {
for i, elemName := range path {
var err error
vvv, err = evaluateSubElem(vvv, elemName)
if err != nil {
continue
}
if i < len(path)-1 && vvv.IsValid() {
if params, ok := vvv.Interface().(maps.Params); ok {
// The current path element is the map itself, .Params.
vvv = reflect.ValueOf(params.Get(path[i+1:]...))
break
}
}
}
}
} else {