sql_insight/
lib.rs

1//! # sql-insight
2//!
3//! `sql-insight` is a utility designed for SQL query analysis, formatting, and transformation.
4//!
5//! ## Main Functionalities
6//!
7//! - **SQL Formatting**: Format SQL queries into a standardized format. See the [`formatter`] module for more information.
8//! - **SQL Normalization**: Normalize SQL queries by abstracting literals. See the [`normalizer`] module for more information.
9//! - **Table Extraction**: Extract tables within SQL queries. See the [`table_extractor`] module for more information.
10//! - **CRUD Table Extraction**: Extract CRUD tables from SQL queries. See the [`crud_table_extractor`] module for more information.
11//!
12//! ## Quick Start
13//!
14//! Here's a quick example to get you started with SQL formatting:
15//!
16//! ```rust
17//! use sql_insight::sqlparser::dialect::GenericDialect;
18//!
19//! let dialect = GenericDialect {};
20//! let normalized_sql = sql_insight::format(&dialect, "SELECT * \n from users   WHERE id = 1").unwrap();
21//! assert_eq!(normalized_sql, ["SELECT * FROM users WHERE id = 1"]);
22//! ```
23//!
24//! For more comprehensive examples and usage, refer to [crates.io](https://crates.io/crates/sql-insight) or the documentation of each module.
25
26pub mod error;
27pub mod extractor;
28pub mod formatter;
29pub mod normalizer;
30
31pub use extractor::*;
32pub use formatter::*;
33pub use normalizer::*;
34pub use sqlparser;
35
36#[doc(hidden)]
37// Internal module for testing. Made public for use in integration tests.
38pub mod test_utils;