Expand description
Compile time dynamic SQL generator.
This is the compiler behind #[py_sql], #[html_sql] and #[sql] (provided by
the rbatis-macro-driver crate and re-exported as
rbatis::rbatis_codegen). A dynamic SQL
template is parsed here and turned into plain Rust source code, which is then
compiled by the rustc invocation that is already running. That is why a query
written in py_sql/html_sql runs as fast as hand written SQL: nothing is
interpreted at runtime.
codegen::funcholds the code generation functionscodegen::parser_pysqlandcodegen::parser_htmlparse the two languagescodegen::syntax_tree_pysqlandcodegen::syntax_tree_htmlare the abstract syntax trees they produceopscontains the operators that are available inside a template (+,==,.sql(),.csv(), …)IntoSqlrenders a value as SQL, used by${arg}interpolation
Most users never depend on this crate directly; it is documented because it is re-exported from rbatis.
Re-exports§
Modules§
- codegen
- parsers and code generators of the
py_sqlandhtml_sqllanguages - error
- error type of the code generator
- from_
bool boolhelpers available inside a template expression- into_
sql - rendering a value as SQL, used by
${arg}interpolation - ops
- operators (
+,==,.sql(), …) usable inside a template - ops_add
+operator- ops_
bit_ and &(bit and) operator- ops_
bit_ or |(bit or) operator- ops_cmp
- comparison operators (
>,<,>=,<=) - ops_div
/operator- ops_eq
==operator- ops_mul
*operator- ops_neg
- unary
-operator - ops_not
!operator- ops_rem
%operator- ops_shl
<<operator- ops_shr
>>operator- ops_
string - string helpers (
.sql(),.csv(), …) - ops_sub
-operator- ops_xor
^operator