carddav: add full query AST

This commit is contained in:
Simon Ser
2020-01-24 11:25:58 +01:00
parent e56ab47c43
commit 5ada08f6ab
2 changed files with 54 additions and 25 deletions

View File

@@ -20,9 +20,52 @@ type AddressBookQuery struct {
Props []string
AllProp bool
PropFilters []PropFilter
FilterTest FilterTest // defaults to FilterAnyOf
Limit int // <= 0 means unlimited
}
type PropFilter struct {
Name string
// if IsNotDefined is set, TextMatches and Params need to be unset
IsNotDefined bool
TextMatches []TextMatch
Params []ParamFilter
}
type ParamFilter struct {
Name string
Test FilterTest // defaults to FilterAnyOf
// if IsNotDefined is set, TextMatch needs to be unset
IsNotDefined bool
TextMatch *TextMatch
}
type TextMatch struct {
Text string
NegateCondition bool
MatchType MatchType // defaults to MatchContains
}
type FilterTest string
const (
FilterAnyOf FilterTest = "anyof"
FilterAllOf FilterTest = "allof"
)
type MatchType string
const (
MatchEquals MatchType = "equals"
MatchContains MatchType = "contains"
MatchStartsWith MatchType = "starts-with"
MatchEndsWith MatchType = "ends-with"
)
type AddressBookMultiGet struct {
Paths []string