floz_orm/lib.rs
1//! # floz
2//!
3//! A lightweight, typesafe Rust ORM that unifies DAO (Active Record) and
4//! DSL (Query Builder) APIs from a single `schema!` definition.
5//!
6//! ```ignore
7//! use floz::prelude::*;
8//!
9//! floz::schema! {
10//! model User("users") {
11//! id: integer("id").auto_increment().primary(),
12//! name: varchar("name", 100),
13//! age: short("age"),
14//! }
15//! }
16//! ```
17
18// Allow the proc macro codegen to reference `floz::` paths regardless of
19// how consumers alias this crate (e.g. `floz-orm` vs `floz`).
20extern crate self as floz;
21
22// Re-export the schema! proc macro
23pub use floz_macros::schema;
24
25// Re-export the #[model] attribute macro
26pub use floz_macros::model;
27
28// Core modules
29pub mod types;
30mod value;
31mod error;
32mod column;
33mod expr;
34mod query;
35mod db;
36mod paginate;
37mod hooks;
38
39// Public API
40pub use value::Value;
41pub use error::FlozError;
42pub use column::{Column, AnyColumn};
43pub use expr::{Expr, OrderExpr, OrderDirection};
44pub use db::{Db, Tx, Executor, FlozRowBound};
45pub use query::select::SelectQuery;
46pub use query::insert::{InsertQuery, InsertManyQuery};
47pub use query::update::UpdateQuery;
48pub use query::delete::DeleteQuery;
49pub use paginate::{Paginated, PaginateQuery};
50pub use hooks::FlozHooks;
51
52// Re-export sqlx — the floz crate accesses SQL primitives through floz_orm,
53// keeping sqlx as a single-owner dependency.
54pub use sqlx;
55
56pub mod prelude;
57pub mod migration;