Skip to main content

fletch_orm/
lib.rs

1//! Fletch — a lightweight database toolkit built on SQLx.
2//!
3//! Fletch provides a thin, type-safe layer over SQLx with entity metadata,
4//! dialect-generic CRUD operations, query building with dialect support for
5//! SQLite, PostgreSQL, and MySQL, connection pooling, and transaction management.
6//!
7//! **API tiers:** Root re-exports cover the common path (entities, pools,
8//! query builder, dialects, CRUD). Submodules such as [`connection`] and
9//! [`query_builder`] are for advanced usage and query authoring. Free functions
10//! in [`ops`] accept any [`Executor`] for custom execution contexts.
11
12mod bind;
13pub mod built_query;
14pub mod column;
15pub mod connection;
16pub mod dialect;
17pub mod entity;
18pub mod error;
19pub mod filter;
20pub mod ops;
21pub mod pool;
22pub mod query_builder;
23pub mod value;
24
25// Re-export core types at the crate root.
26pub use column::{Column, ColumnType};
27pub use connection::Executor;
28pub use entity::Entity;
29pub use error::FletchError;
30pub use pool::{Pool, PoolBuilder, PoolConfig, Transaction};
31pub use value::Value;
32
33// Re-export CRUD free functions.
34pub use ops::{delete, fetch_all, find_all, find_by_id, insert, update};
35
36// Re-export query builder types at the crate root.
37pub use built_query::BuiltQuery;
38pub use dialect::{Dialect, MySqlDialect, PostgresDialect, SqliteDialect};
39pub use filter::{Filter, Op};
40pub use query_builder::{Order, QueryBuilder};
41
42// Re-export sqlx for row mapping and generated entity code.
43pub use sqlx;
44pub use sqlx::FromRow;
45
46// Re-export derive macro when macros feature is enabled.
47#[cfg(feature = "macros")]
48pub use fletch_orm_macros::Entity;