1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! `rpsql` preprocesses SQL files: variables, includes and comments.
//!
//! A build starts at an entry point and runs in two passes. The first one
//! applies the directives of every file, inlining the included files, so that
//! the variables of a file are all known before any of them is used. The
//! second one replaces the variable references that are left.
//!
//! ```no_run
//! use rpsql::Builder;
//!
//! let sql = Builder::new("main.sql").build()?;
//! # Ok::<(), rpsql::Error>(())
//! ```
//!
//! | Reference | Meaning |
//! | --- | --- |
//! | `@set name = value` | sets a variable of the file |
//! | `@set global name = value` | sets a variable of the global scope |
//! | `@unset name` | removes a variable |
//! | `@include path` | inlines a file, or the `index.sql` of a directory |
//! | `$name`, `${name}` | the value of a variable, `\$` for a literal `$` |
//! | `-- comment` | a comment, the whole line is dropped |
pub use Action;
pub use Builder;
pub use Context;
pub use ;
pub use ;
pub use Level;
pub use VariableScope;
pub use Writer;
/// The version of the crate.
pub const VERSION: &str = env!;