locksmith

Crates.iolocksmith
lib.rslocksmith
version0.2.1
created_at2023-11-13 11:19:52.434337+00
updated_at2025-02-08 23:54:52.089853+00
descriptionExtract Postgres locks from a given SQL statement
homepage
repositoryhttps://github.com/orf/locksmith
max_upload_size
id1033509
size127,638
Tom Forbes (orf)

documentation

README

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);
}
Commit count: 18

cargo fmt