Expand description
This is the crate documentation for eugene.
This crate provides a library and a binary for tracing locks taken by SQL statements in a PostgreSQL database. It can be used to analyze the locking behavior of SQL scripts and to review migration scripts that could potentially interfere with other operations, such as concurrent queries by application code.
THe library also provides syntax tree analysis for SQL scripts, so it can be used to analyze migration scripts for potential issues before running them.
Modules§
- error
- git
- Utilities for invoking git
- hint_
data - Static data for hints and lints, used to identify them in output or input.
- hints
- Hints that can help avoid dangerous migrations, by minimizing time spent holding dangerous locks.
- lints
- Hints that can be trigged only by looking at the SQL script, without running it.
- output
- Generate output structures for lock traces and static data like lock modes. This module is used by the binary to generate output in various formats is currently the best documentation of output format, and can be considered a public api for the library.
- parse_
scripts - Utilities for converting a single SQL file with multiple scripts into a list of scripts.
- pg_
types - Types that directly translate to postgres concepts like lock modes and relkinds.
- pgpass
- Parse the postgres PGPASS file format.
- script_
discovery - Walk the file system and list migration scripts in sorted order
- sqltext
- Read and parse simple SQL scripts, resolve placeholders and break down into statements.
- tempserver
- This module is for creating and destroying postgres database instances for eugene to trace.
- tracing
- Trace locks taken by SQL statements. Structures and data from here should be considered internal to the crate, their fields are not part of the public API.
- utils
Structs§
- Client
Source - Connection settings for connecting to a PostgreSQL database.
- SqlScript
Traits§
Functions§
- parse_
placeholders - Parse placeholders in the form of name=value into a map.
- perform_
trace - Perform a lock trace of a SQL script and optionally commit the transaction, depending on trace_settings.
- read_
script - Read a SQL script from a source and resolve placeholders.