rusticx 1.0.0

Blazingly fast, async-first, multi-database ORM for Rust (PostgreSQL, MySQL, MongoDB)
Documentation
//! # Rusticx ORM
//!
//! Blazingly fast, async-first, multi-database ORM for Rust.
//!
//! ## Quick start
//!
//! ```toml
//! [dependencies]
//! rusticx = { version = "0.1", features = ["postgres"] }
//! tokio = { version = "1", features = ["full"] }
//! serde = { version = "1", features = ["derive"] }
//! ```
//!
//! ```rust,ignore
//! use rusticx::prelude::*;
//! use serde::{Deserialize, Serialize};
//! use uuid::Uuid;
//!
//! #[derive(Debug, Serialize, Deserialize, Model)]
//! #[rusticx(table = "users")]
//! pub struct User {
//!     #[rusticx(primary_key)]
//!     pub id: Uuid,
//!     pub name: String,
//!     pub email: String,
//!     pub age: i32,
//! }
//!
//! #[tokio::main]
//! async fn main() -> rusticx::Result<()> {
//!     // Connect
//!     let adapter = PostgresAdapter::connect_url("postgres://localhost/mydb").await?;
//!     let repo: Repository<User, _> = Repository::new(Arc::new(adapter));
//!
//!     // Auto-create table
//!     repo.migrate().await?;
//!
//!     // Insert
//!     let user = User { id: Uuid::new_v4(), name: "Alice".into(), email: "alice@example.com".into(), age: 30 };
//!     let inserted = repo.insert(&user).await?;
//!
//!     // Find by ID
//!     let found = repo.find_by_id(inserted.id).await?;
//!
//!     // Query builder
//!     let adults = repo.find(
//!         repo.query().r#where("age", CondOp::Gte, 18).order_by("name", Direction::Asc)
//!     ).await?;
//!
//!     // Delete
//!     repo.delete_by_id(inserted.id).await?;
//!     Ok(())
//! }
//! ```

// ── Core re-exports ────────────────────────────────────────────────────────────
pub use rusticx_core::{
    adapter::{DatabaseAdapter, SyncAdapter},
    column::{ColumnDef, ColumnType},
    error::{Result, RusticxError},
    model::{Model, TableSchema},
    query::{CondOp, Direction, Operation, QueryBuilder},
    repository::Repository,
    value::{Row, Value},
};

// ── Derive macro re-export ─────────────────────────────────────────────────────
pub use rusticx_macros::Model;

// ── Backend re-exports (feature-gated) ───────────────────────────────────────

#[cfg(feature = "postgres")]
pub use rusticx_postgres::{PostgresAdapter, PostgresConfig};

#[cfg(feature = "mysql")]
pub use rusticx_mysql::{MysqlAdapter, MysqlConfig};

#[cfg(feature = "mongo")]
pub use rusticx_mongo::{MongoAdapter, MongoConfig};

// ── Prelude ────────────────────────────────────────────────────────────────────

pub mod prelude {
    pub use crate::{
        CondOp, ColumnDef, ColumnType, DatabaseAdapter, Direction, Model, Operation,
        QueryBuilder, Repository, Result, Row, RusticxError, SyncAdapter,
        TableSchema, Value,
    };

    #[cfg(feature = "postgres")]
    pub use crate::{PostgresAdapter, PostgresConfig};

    #[cfg(feature = "mysql")]
    pub use crate::{MysqlAdapter, MysqlConfig};

    #[cfg(feature = "mongo")]
    pub use crate::{MongoAdapter, MongoConfig};

    pub use std::sync::Arc;
}