Skip to main content

zeph_db/
bounds.rs

1// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4//! [`FullDriver`] blanket super-trait for reducing sqlx bound repetition.
5
6use crate::DatabaseDriver;
7
8/// Marker trait automatically implemented for all [`DatabaseDriver`] types
9/// whose `Database` supports standard Rust types in queries (sqlx 0.9 bounds).
10///
11/// This trait exists solely to reduce bound repetition on generic impl blocks.
12/// It is sealed: all impls are inside this crate.
13pub trait FullDriver: DatabaseDriver
14where
15    <Self::Database as sqlx::Database>::Arguments: sqlx::IntoArguments<Self::Database>,
16    for<'c> &'c mut <Self::Database as sqlx::Database>::Connection:
17        sqlx::Executor<'c, Database = Self::Database>,
18    i64: for<'q> sqlx::Encode<'q, Self::Database> + sqlx::Type<Self::Database>,
19    i32: for<'q> sqlx::Encode<'q, Self::Database> + sqlx::Type<Self::Database>,
20    String: for<'q> sqlx::Encode<'q, Self::Database> + sqlx::Type<Self::Database>,
21    bool: for<'q> sqlx::Encode<'q, Self::Database> + sqlx::Type<Self::Database>,
22    Vec<u8>: for<'q> sqlx::Encode<'q, Self::Database> + sqlx::Type<Self::Database>,
23{
24}
25
26#[cfg(feature = "sqlite")]
27impl FullDriver for crate::driver::SqliteDriver {}
28#[cfg(feature = "postgres")]
29impl FullDriver for crate::driver::PostgresDriver {}