Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methods for modifying an AST object #498

Open
labs20 opened this issue Nov 9, 2020 · 1 comment
Open

Methods for modifying an AST object #498

labs20 opened this issue Nov 9, 2020 · 1 comment
Assignees

Comments

@labs20
Copy link

labs20 commented Nov 9, 2020

Hi.

Methods for modifying an type="select" node of an AST object would be awesome.

For example:

let sqlObj = sqlParser.astify(my_huge_sql);

if (something){

    sqlParser.addJoin(sqlObj, join_params);

    sqlParser.addWhere(sqlObj, where_params);

}

let final_sql = sqlParser.sqlify(sqlObj, {database: 'TransactSQL'})

Thanks!

@nicoabie
Copy link

hey @labs20 here you can see examples on how to traverse the AST in a simply manner.
https://github.com/ReMatter/paranoid-sql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants