ferriorm_codegen/lib.rs
1#![warn(clippy::pedantic)]
2
3//! Code generator that produces a type-safe Rust client from a validated schema.
4//!
5//! Given an [`ferriorm_core::schema::Schema`], this crate emits a complete Rust
6//! module tree consisting of:
7//!
8//! - **Model structs** with `sqlx::FromRow` derives ([`model`])
9//! - **Enum definitions** with `sqlx::Type` derives ([`enums`])
10//! - **Filter / order / data submodules** for type-safe queries ([`model`])
11//! - **Relation types** and batched include loading ([`relations`])
12//! - **`FerriormClient`** -- the entry-point struct users interact with ([`client`])
13//!
14//! The main entry point is [`generator::generate`], which writes all files to
15//! the configured output directory.
16//!
17//! # Related crates
18//!
19//! - `ferriorm_core` -- the `Schema` IR consumed by this crate.
20//! - `ferriorm_parser` -- parses `.ferriorm` files into the `Schema` IR.
21//! - `ferriorm_runtime` -- the runtime library that generated code depends on.
22
23pub mod client;
24pub mod enums;
25pub mod formatter;
26pub mod generator;
27pub mod model;
28pub mod relations;
29
30mod rust_type;