mirror of
https://github.com/pikami/cosmium.git
synced 2025-12-20 09:20:11 +00:00
Implement CONTAINS function
This commit is contained in:
@@ -306,7 +306,7 @@ BooleanLiteral <- ("true"i / "false"i) {
|
||||
return parsers.Constant{Type: parsers.ConstantTypeBoolean, Value: boolValue}, nil
|
||||
}
|
||||
|
||||
FunctionCall <- StringEqualsExpression / ConcatExpression / IsDefined
|
||||
FunctionCall <- StringEqualsExpression / ConcatExpression / ContainsExpression / IsDefined
|
||||
|
||||
StringEqualsExpression <- StringEquals ws "(" ws ex1:SelectItem ws "," ws ex2:SelectItem ws ignoreCase:("," ws boolean:SelectItem { return boolean, nil })? ")" {
|
||||
return parsers.FunctionCall{Type: parsers.FunctionCallStringEquals, Arguments: []interface{}{ex1, ex2, ignoreCase}}, nil
|
||||
@@ -317,6 +317,10 @@ ConcatExpression <- "CONCAT"i ws "(" ws ex1:SelectItem others:(ws "," ws ex:Sele
|
||||
return parsers.FunctionCall{Type: parsers.FunctionCallConcat, Arguments: arguments}, nil
|
||||
}
|
||||
|
||||
ContainsExpression <- "CONTAINS"i ws "(" ws ex1:SelectItem ws "," ws ex2:SelectItem ws ignoreCase:("," ws boolean:SelectItem { return boolean, nil })? ")" {
|
||||
return parsers.FunctionCall{Type: parsers.FunctionCallContains, Arguments: []interface{}{ex1, ex2, ignoreCase}}, nil
|
||||
}
|
||||
|
||||
IsDefined <- "IS_DEFINED"i ws "(" ws ex:SelectItem ws ")" {
|
||||
return parsers.FunctionCall{Type: parsers.FunctionCallIsDefined, Arguments: []interface{}{ex}}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user