floz-orm 0.1.6

A lightweight, typesafe Rust ORM — unifying DAO and DSL from a single schema
Documentation
//! `FlozRowBound` — cfg-gated trait alias for `sqlx::FromRow` bounds.
//!
//! This marker trait adapts to enabled database features:
//! - `postgres` only → requires `FromRow<PgRow>`
//! - `sqlite` only → requires `FromRow<SqliteRow>`
//! - both → requires both
//!
//! Since `#[derive(sqlx::FromRow)]` generates a generic impl over all
//! row types, any `schema!` model automatically satisfies `FlozRowBound`.

#[cfg(feature = "postgres")]
use sqlx::postgres::PgRow;
#[cfg(feature = "sqlite")]
use sqlx::sqlite::SqliteRow;

// ── Postgres only ──

#[cfg(all(feature = "postgres", not(feature = "sqlite")))]
pub trait FlozRowBound: for<'r> sqlx::FromRow<'r, PgRow> {}

#[cfg(all(feature = "postgres", not(feature = "sqlite")))]
impl<T> FlozRowBound for T where T: for<'r> sqlx::FromRow<'r, PgRow> {}

// ── SQLite only ──

#[cfg(all(feature = "sqlite", not(feature = "postgres")))]
pub trait FlozRowBound: for<'r> sqlx::FromRow<'r, SqliteRow> {}

#[cfg(all(feature = "sqlite", not(feature = "postgres")))]
impl<T> FlozRowBound for T where T: for<'r> sqlx::FromRow<'r, SqliteRow> {}

// ── Both enabled ──

#[cfg(all(feature = "postgres", feature = "sqlite"))]
pub trait FlozRowBound:
    for<'r> sqlx::FromRow<'r, PgRow> + for<'r> sqlx::FromRow<'r, SqliteRow>
{
}

#[cfg(all(feature = "postgres", feature = "sqlite"))]
impl<T> FlozRowBound for T where
    T: for<'r> sqlx::FromRow<'r, PgRow> + for<'r> sqlx::FromRow<'r, SqliteRow>
{
}

// ── No database features ──

#[cfg(not(any(feature = "postgres", feature = "sqlite")))]
pub trait FlozRowBound {}

#[cfg(not(any(feature = "postgres", feature = "sqlite")))]
impl<T> FlozRowBound for T {}