SQL Parser Derive Macro
Visit
This crate contains a procedural macro that can automatically derive
implementations of the Visit
trait in the sqlparser crate
Will generate code akin to
Some types may wish to call a corresponding method on the visitor:
This will result in the following sequence of visitor calls when an IsNull
expression is visited
visitor.pre_visit_expr(<is null expr>)
visitor.pre_visit_expr(<is null operand>)
visitor.post_visit_expr(<is null operand>)
visitor.post_visit_expr(<is null expr>)
For some types it is only appropriate to call a particular visitor method in
some contexts. For example, not every ObjectName
refers to a relation.
In these cases, the visit
attribute can be used on the field for which we'd
like to call the method:
This will generate
Note that annotating both the type and the field is incorrect as it will result in redundant calls to the method. For example
will result in these calls to the visitor
visitor.pre_visit_expr(<is null expr>)
visitor.pre_visit_expr(<is null operand>)
visitor.pre_visit_expr(<is null operand>)
visitor.post_visit_expr(<is null operand>)
visitor.post_visit_expr(<is null operand>)
visitor.post_visit_expr(<is null expr>)
Releasing
This crate's release is not automated. Instead it is released manually as needed
Steps:
- Update the version in
Cargo.toml
- Update the corresponding version in
../Cargo.toml
- Commit via PR
- Publish to crates.io:
# update to latest checked in main branch and publish via
cargo publish