func (this *NNF) VisitFunction(expr expression.Function) (interface{}, error) { var exp expression.Expression = expr switch expr := expr.(type) { case *expression.IsBoolean: exp = expression.NewLE(expr.Operand(), expression.TRUE_EXPR) case *expression.IsNumber: exp = expression.NewAnd( expression.NewGT(expr.Operand(), expression.TRUE_EXPR), expression.NewLT(expr.Operand(), expression.EMPTY_STRING_EXPR)) case *expression.IsString: exp = expression.NewAnd( expression.NewGE(expr.Operand(), expression.EMPTY_STRING_EXPR), expression.NewLT(expr.Operand(), expression.EMPTY_ARRAY_EXPR)) case *expression.IsArray: exp = expression.NewAnd( expression.NewGE(expr.Operand(), expression.EMPTY_ARRAY_EXPR), expression.NewLT(expr.Operand(), _EMPTY_OBJECT_EXPR)) case *expression.IsObject: // Not equivalent to IS OBJECT. Includes BINARY values. exp = expression.NewGE(expr.Operand(), _EMPTY_OBJECT_EXPR) } return exp, exp.MapChildren(this) }
func (this *NNF) VisitBetween(expr *expression.Between) (interface{}, error) { err := expr.MapChildren(this) if err != nil { return nil, err } return expression.NewAnd(expression.NewGE(expr.First(), expr.Second()), expression.NewLE(expr.First(), expr.Third())), nil }