added match logic and query error checking
This commit is contained in:
parent
e309b478f5
commit
5a8e1e6cf6
4 changed files with 315 additions and 70 deletions
11
cmd/main.go
11
cmd/main.go
|
|
@ -36,16 +36,19 @@ var data = Filter{
|
|||
{"str1", 42, true, Struct1{"s1", Struct2{1}}},
|
||||
{"2str", 42, true, Struct1{"s2", Struct2{2}}},
|
||||
{"str3", 42, false, Struct1{"s3", Struct2{3}}},
|
||||
{":", 42, false, Struct1{"s3", Struct2{3}}},
|
||||
}
|
||||
|
||||
func main() {
|
||||
f := filter.NewQuery("String:s*").GenericFilter(data)
|
||||
if f != nil {
|
||||
for _, v := range f.(Filter) {
|
||||
f, _ := filter.NewQuery("String:s*", filter.AND)
|
||||
d := f.GenericFilter(data)
|
||||
if d != nil {
|
||||
for _, v := range d.(Filter) {
|
||||
fmt.Println("Generic:", v)
|
||||
}
|
||||
}
|
||||
filter.NewQuery("String:s*").Filter(&data)
|
||||
f, _ = filter.NewQuery("Struct.Struct.Int:1 Struct.Struct.Int:2 String::", filter.OR)
|
||||
f.Filter(&data)
|
||||
for _, v := range data {
|
||||
fmt.Println("Interface:", v)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue