frostfs-node/pkg/services/object/search/query/v1/keys.go
Leonard Lyubich 39c324bd6d [#39] service/object: Add query filters to search right child
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-02 11:25:36 +03:00

27 lines
642 B
Go

package query
import (
"github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-node/pkg/services/object/search/query"
)
// FIXME: this is a temporary solution for object fields filters
const keyChildrenField = "Object.Header.Split.Children"
const keyParentIDField = "Object.Header.Split.Parent"
func NewEmptyChildrenFilter() *Filter {
return NewFilterEqual(keyChildrenField, "")
}
func NewParentIDFilter(par *object.ID) *Filter {
return NewFilterEqual(keyParentIDField, idValue(par))
}
func NewRightChildQuery(par *object.ID) query.Query {
return New(
NewParentIDFilter(par),
NewEmptyChildrenFilter(),
)
}