toolu_orm/lib.rs
1//! Single entry point for the toolu-orm workspace.
2//!
3//! `toolu-orm` is a facade: it contains no logic of its own, only re-exports
4//! of the four library crates, all pinned to one version.
5//!
6//! ```toml
7//! toolu-orm = { version = "0.1", features = ["postgres"] }
8//! ```
9//!
10//! | Re-export | Crate | Holds |
11//! |---|---|---|
12//! | [`core`] | `toolu-orm-core` | schema, columns, migrations, driver traits |
13//! | [`query`] | `toolu-orm-query` | select / insert / update / delete builders |
14//! | [`connection`] | `toolu-orm-connection` | pools and driver adapters |
15//! | [`table`], [`ColumnEnum`], [`FromRow`], [`Relational`] | `toolu-orm-macros` | proc macros |
16//!
17//! ## Features
18//!
19//! `libsql`, `rusqlite` and `postgres` forward to every re-exported crate, so
20//! one feature list drives the whole stack. Enable exactly one: `toolu-orm-query`
21//! compiles its executor and transaction code only for a single driver.
22//!
23//! ## Macro paths
24//!
25//! The proc macros expand to absolute paths resolved against the consuming
26//! crate's `Cargo.toml`: `::toolu_orm::core::…` when this facade is the
27//! dependency, `::toolu_orm_core::…` when the crates are named directly. So
28//! `toolu-orm` on its own is enough — import the macro and nothing else:
29//!
30//! ```ignore
31//! use toolu_orm::table;
32//!
33//! #[table(name = "users")]
34//! pub struct User {
35//! pub id: i64,
36//! pub email: String,
37//! }
38//! ```
39//!
40//! The [`prelude`] remains for code that names `toolu_orm_core`,
41//! `toolu_orm_query` or the driver crate itself; the macros do not need it.
42
43pub use toolu_orm_connection as connection;
44pub use toolu_orm_core as core;
45pub use toolu_orm_query as query;
46
47pub use toolu_orm_macros::{fts5_table, table, ColumnEnum, FromRow, Relational};
48
49/// The macros plus the crate names they used to require.
50///
51/// The expansions resolve on their own now, so this is a convenience: glob it
52/// when your own code wants to write `toolu_orm_core::…`, `toolu_orm_query::…`
53/// or the driver crate for the enabled feature without naming the facade path
54/// each time.
55pub mod prelude {
56 pub use toolu_orm_core;
57 pub use toolu_orm_query;
58
59 pub use toolu_orm_macros::{fts5_table, table, ColumnEnum, FromRow, Relational};
60
61 #[cfg(feature = "libsql")]
62 pub use toolu_orm_core::libsql;
63 #[cfg(feature = "rusqlite")]
64 pub use toolu_orm_core::rusqlite;
65 #[cfg(feature = "postgres")]
66 pub use toolu_orm_core::tokio_postgres;
67}