redact

Function redact 

Source
pub fn redact(dialect: &dyn Dialect, sql: &str) -> Result<String, Error>
Expand description

Replace all Value nodes in an AST with ‘?’

Examples found in repository?
examples/bench.rs (lines 8-14)
3fn main() {
4    let t = std::time::Instant::now();
5    const N: usize = 10000;
6    for _ in 0..N {
7        // redact(&MySqlDialect {}, "SELECT * FROM foo WHERE bar = 1").unwrap();
8        redact(
9            &MySqlDialect {},
10            "SELECT * FROM users 
11        WHERE age > 18 
12        AND city = 'New York' 
13        ORDER BY last_name ASC;",
14        )
15        .unwrap();
16    }
17    dbg!(t.elapsed().div_f64(N as f64));
18}