Expand description
§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);
}Structs§
- Column
Object - A column in a given table, with a data type
- ConnectionID
- A Postgres connection ID. Connections IDs can be retrieved via the pg_backend_pid function.
- Index
Object - An index on a table, identified by its name
- Inspected
Statement - InspectedStatement is a struct that contains the side effects of inspecting a SQL statement. It includes the objects that were added, removed, locked, and rewritten by the statement.
- Query
Oracle - Table
Lock - A lock on a specific table
- Table
Object - A table, identified by its name