2020-09-23 10:41:09 +00:00
|
|
|
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
|
|
|
|
|
2020-10-01 09:02:53 +00:00
|
|
|
const keyParentField = "Object.Header.Split.WithChildren"
|
|
|
|
|
|
|
|
const keyNoChildrenField = "Object.Header.Split.NoChildren"
|
2020-09-23 10:41:09 +00:00
|
|
|
|
|
|
|
const keyParentIDField = "Object.Header.Split.Parent"
|
|
|
|
|
2020-10-01 12:12:39 +00:00
|
|
|
func NewRightChildQuery(par *object.ID) query.Query {
|
|
|
|
q := &Query{
|
|
|
|
filters: make(object.SearchFilters, 0, 2),
|
|
|
|
}
|
2020-09-23 10:41:09 +00:00
|
|
|
|
2020-10-01 12:12:39 +00:00
|
|
|
q.filters.AddFilter(keyParentIDField, idValue(par), object.MatchStringEqual)
|
|
|
|
q.filters.AddFilter(keyNoChildrenField, "", object.MatchStringEqual)
|
2020-09-23 10:41:09 +00:00
|
|
|
|
2020-10-01 12:12:39 +00:00
|
|
|
return q
|
2020-09-23 10:41:09 +00:00
|
|
|
}
|
2020-10-01 09:02:53 +00:00
|
|
|
|
|
|
|
func NewLinkingQuery(par *object.ID) query.Query {
|
2020-10-01 12:12:39 +00:00
|
|
|
q := &Query{
|
|
|
|
filters: make(object.SearchFilters, 0, 2),
|
|
|
|
}
|
|
|
|
|
|
|
|
q.filters.AddFilter(keyParentIDField, idValue(par), object.MatchStringEqual)
|
|
|
|
q.filters.AddFilter(keyParentField, "", object.MatchStringEqual)
|
|
|
|
|
|
|
|
return q
|
2020-10-01 09:02:53 +00:00
|
|
|
}
|