1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
//! # Premix ORM
//!
//! > **"Write Rust, Run Optimized SQL."**
//!
//! Premix is a zero-overhead, type-safe ORM for Rust. It generates SQL at
//! compile time with macros and executes via `sqlx`.
//!
//! ## Key Features
//!
//! - Auto-sync schema from models.
//! - Compile-time SQL generation (no runtime reflection).
//! - Application-level joins with batched `WHERE IN` queries.
//! - SQLite, Postgres, and MySQL support via `sqlx`.
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use premix_orm::prelude::*;
//! use serde::{Deserialize, Serialize};
//!
//! #[derive(Model, Debug, Serialize, Deserialize)]
//! struct User {
//! id: i32,
//! name: String,
//! }
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let pool = Premix::smart_sqlite_pool("sqlite::memory:").await?;
//! premix_orm::Premix::sync::<premix_orm::sqlx::Sqlite, User>(&pool).await?;
//!
//! let mut user = User { id: 0, name: "Alice".to_string() };
//! user.save(&pool).await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Relations and Eager Loading
//!
//! ```rust,no_run
//! use premix_orm::prelude::*;
//!
//! #[derive(Model)]
//! struct User {
//! id: i32,
//! name: String,
//!
//! #[has_many(Post)]
//! #[premix(ignore)]
//! posts: Option<Vec<Post>>,
//! }
//!
//! #[derive(Model)]
//! #[belongs_to(User)]
//! struct Post {
//! id: i32,
//! user_id: i32,
//! title: String,
//! }
//!
//! # async fn example(pool: premix_orm::sqlx::SqlitePool) -> Result<(), sqlx::Error> {
//! let _users = User::find_in_pool(&pool).include("posts").all().await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Bulk Operations
//!
//! ```rust,no_run
//! use premix_orm::prelude::*;
//! use serde_json::json;
//!
//! #[derive(Model)]
//! struct User {
//! id: i32,
//! status: String,
//! }
//!
//! # async fn example(pool: premix_orm::sqlx::SqlitePool) -> Result<(), sqlx::Error> {
//! let _updated = User::find_in_pool(&pool)
//! .filter_eq("status", "inactive")
//! .update(json!({ "status": "active" }))
//! .await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Installation
//!
//! ```toml
//! [dependencies]
//! premix-orm = "1.0.7-alpha"
//! ```
//!
//! ## Book
//!
//! A longer-form guide lives in `orm-book/` at the repository root. It covers
//! models, queries, relations, migrations, transactions, and limitations.
pub use *;
pub use Model;
/// Compile-time query macro for true Zero-Overhead SQL generation.
///
/// This macro generates SQL at compile time, achieving 0% overhead compared to raw sqlx.
///
/// # Example
///
/// ```ignore
/// use premix_orm::prelude::*;
///
/// let user = premix_query!(User, FIND, filter_eq("id", user_id))
/// .fetch_one(&pool)
/// .await?;
/// ```
pub use premix_query;
/// Integration with common web frameworks (Axum, Actix, etc.).
pub use *;
pub use *;
/// The Premix prelude, re-exporting commonly used traits and types.