Crate sqllogictest

source ·
Expand description

Sqllogictest parser and runner.

§Usage

Implement DB trait for your database structure:

struct Database {...}

impl sqllogictest::DB for Database {
    type Error = ...;
    fn run(&self, sql: &str) -> Result<String, Self::Error> {
        ...
    }
}

Create a Runner on your database instance, and then run the script:

let mut tester = sqllogictest::Runner::new(Database::new());
let script = std::fs::read_to_string("script.slt").unwrap();
tester.run_script(&script);

You can also parse the script and execute the records separately:

let records = sqllogictest::parse(&script).unwrap();
for record in records {
    tester.run(record);
}

Re-exports§

Modules§

Macros§

  • db_fn: fn() -> sqllogictest::AsyncDBpattern: The glob used to match against and select each file to be tested. It is relative to the root of the crate.