3 unstable releases

0.2.1 Feb 8, 2025
0.2.0 Feb 8, 2025
0.1.0 Nov 13, 2023

#1160 in Database interfaces

Download history 10/week @ 2024-12-06 222/week @ 2025-02-07 33/week @ 2025-02-14

255 downloads per month
Used in locksmith-cli

MIT license

39KB
655 lines

Locksmith

This crate provides the logic for detecting the impact of a given SQL statement on a Postgres database.

It is the brains behind locksmith-cli.

Detecting the impact of a statement

use locksmith::QueryOracle;

async fn inspect_statement() {
    let mut oracle = QueryOracle::new("postgres://localhost:5432/mydb");
    let inspection = oracle.inspect_statement("alter table customers alter column id type bigint;").await.unwrap();
    println!("{:?}", inspection.locks);
}

Dependencies

~52MB
~1M SLoC