Sfoglia il codice sorgente

WIP collections

Signed-off-by: Niko Kovacevic <nikovacevic@gmail.com>
Niko Kovacevic 2 anni fa
parent
commit
61259a86d2
2 ha cambiato i file con 14 aggiunte e 0 eliminazioni
  1. 9 0
      pkg/filter21/ast/ops.go
  2. 5 0
      pkg/filter21/ast/walker.go

+ 9 - 0
pkg/filter21/ast/ops.go

@@ -191,3 +191,12 @@ type ContainsSuffixOp struct {
 func (_ *ContainsSuffixOp) Op() FilterOp {
 	return FilterOpContainsSuffix
 }
+
+func Not(fn FilterNode) FilterNode {
+	return &NotOp{Operand: fn}
+}
+
+func IsVoid(fn FilterNode) bool {
+	_, ok := fn.(*VoidOp)
+	return ok
+}

+ 5 - 0
pkg/filter21/ast/walker.go

@@ -407,3 +407,8 @@ func Fields(filter FilterNode) []Field {
 
 	return response
 }
+
+func ToString(filter FilterNode) string {
+	// TODO make this return a parseable filter string, if possible...
+	return ToPreOrderShortString(filter)
+}