[#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:
Leonard Lyubich 2021-02-01 20:57:18 +03:00 committed by Alex Vanin
parent e9ae408c3a
commit ebff07aaf2
5 changed files with 16 additions and 2 deletions

View file

@ -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
}

View file

@ -14,6 +14,8 @@ var (
eqV2Matches = map[object.SearchMatchType]v2object.MatchType{
object.MatchUnknown: v2object.MatchUnknown,
object.MatchStringEqual: v2object.MatchStringEqual,
object.MatchStringNotEqual: v2object.MatchStringNotEqual,
object.MatchNotPresent: v2object.MatchNotPresent,
}
)

Binary file not shown.

Binary file not shown.

View file

@ -226,6 +226,8 @@ const (
const (
MatchUnknown MatchType = iota
MatchStringEqual
MatchStringNotEqual
MatchNotPresent
)
func (h *ShortHeader) GetVersion() *refs.Version {