Implement CONCAT function

This commit is contained in:
Pijus Kamandulis
2024-02-21 20:16:52 +02:00
parent f047395dd1
commit 8ab9680c99
7 changed files with 315 additions and 85 deletions

View File

@@ -306,12 +306,17 @@ BooleanLiteral <- ("true"i / "false"i) {
return parsers.Constant{Type: parsers.ConstantTypeBoolean, Value: boolValue}, nil
}
FunctionCall <- StringEqualsExpression / IsDefined
FunctionCall <- StringEqualsExpression / ConcatExpression / 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
}
ConcatExpression <- "CONCAT"i ws "(" ws ex1:SelectItem others:(ws "," ws ex:SelectItem { return ex, nil })+ ws ")" {
arguments := append([]interface{}{ex1}, others.([]interface{})...)
return parsers.FunctionCall{Type: parsers.FunctionCallConcat, Arguments: arguments}, nil
}
IsDefined <- "IS_DEFINED"i ws "(" ws ex:SelectItem ws ")" {
return parsers.FunctionCall{Type: parsers.FunctionCallIsDefined, Arguments: []interface{}{ex}}, nil
}