[#254] object: Support new values of search match type
Support STRING_NOT_EQUAL and NOT_PRESENT match types of object search filters. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
e9ae408c3a
commit
ebff07aaf2
5 changed files with 16 additions and 2 deletions
|
@ -15,12 +15,18 @@ type SearchMatchType uint32
|
|||
const (
|
||||
MatchUnknown SearchMatchType = iota
|
||||
MatchStringEqual
|
||||
MatchStringNotEqual
|
||||
MatchNotPresent
|
||||
)
|
||||
|
||||
func (m SearchMatchType) ToV2() v2object.MatchType {
|
||||
switch m {
|
||||
case MatchStringEqual:
|
||||
return v2object.MatchStringEqual
|
||||
case MatchStringNotEqual:
|
||||
return v2object.MatchStringNotEqual
|
||||
case MatchNotPresent:
|
||||
return v2object.MatchNotPresent
|
||||
default:
|
||||
return v2object.MatchUnknown
|
||||
}
|
||||
|
@ -30,6 +36,10 @@ func SearchMatchFromV2(t v2object.MatchType) (m SearchMatchType) {
|
|||
switch t {
|
||||
case v2object.MatchStringEqual:
|
||||
m = MatchStringEqual
|
||||
case v2object.MatchStringNotEqual:
|
||||
m = MatchStringNotEqual
|
||||
case v2object.MatchNotPresent:
|
||||
m = MatchNotPresent
|
||||
default:
|
||||
m = MatchUnknown
|
||||
}
|
||||
|
|
|
@ -12,8 +12,10 @@ import (
|
|||
|
||||
var (
|
||||
eqV2Matches = map[object.SearchMatchType]v2object.MatchType{
|
||||
object.MatchUnknown: v2object.MatchUnknown,
|
||||
object.MatchStringEqual: v2object.MatchStringEqual,
|
||||
object.MatchUnknown: v2object.MatchUnknown,
|
||||
object.MatchStringEqual: v2object.MatchStringEqual,
|
||||
object.MatchStringNotEqual: v2object.MatchStringNotEqual,
|
||||
object.MatchNotPresent: v2object.MatchNotPresent,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
BIN
v2/object/grpc/service.pb.go
generated
BIN
v2/object/grpc/service.pb.go
generated
Binary file not shown.
BIN
v2/object/grpc/types.pb.go
generated
BIN
v2/object/grpc/types.pb.go
generated
Binary file not shown.
|
@ -226,6 +226,8 @@ const (
|
|||
const (
|
||||
MatchUnknown MatchType = iota
|
||||
MatchStringEqual
|
||||
MatchStringNotEqual
|
||||
MatchNotPresent
|
||||
)
|
||||
|
||||
func (h *ShortHeader) GetVersion() *refs.Version {
|
||||
|
|
Loading…
Reference in a new issue