piotr-oles/rsql

support for function calls in ast/parser

Closed this issue · 2 comments

Hi,

I am using the parser to get an AST to build SQL from it. I want to support some function such as today() or aggregate function such as max(column1)

For example

max(year)>=today(-90)

I am looking for a way to get this kind of syntax working. Could you please tell me how hard it would be to make this work. I am currently reading the source code of the AST and parser package.

I think a dirty way would be to allow the parenthesis at those places. However, I think it would be more clean to parse this into a function call node. With function name and arguments.

Anyways, this is a cool library. Thanks for building it.

I will not implement it in the library directly because it's not compatible with the spec, but you can fork this repo and create custom package :) I think that lexer should be compatible - but you would have to modify parser and ast. In the AST, you would have to create new node types (FunctionExpression?) and it would require modification of the parser table and parser production which is not a trivial task. Let me know if you need more guidance.

I'm closing it as there is no activity :)