edge/pkg/storage/filter/or.go

28 lines
502 B
Go

package filter
type OrOperator struct {
children []Operator
}
func (o *OrOperator) Token() Token {
return TokenOr
}
func (o *OrOperator) Children() []Operator {
return o.children
}
func (o *OrOperator) AsMap() map[string]any {
children := make([]map[string]any, 0, len(o.children))
for _, c := range o.children {
children = append(children, c.AsMap())
}
return map[string]any{
string(TokenOr): children,
}
}
func NewOrOperator(ops ...Operator) *OrOperator {
return &OrOperator{ops}
}