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.8 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    for<'q> <Self::Database as sqlx::Database>::Arguments<'q>:
16        sqlx::IntoArguments<'q, Self::Database>,
17    for<'c> &'c mut <Self::Database as sqlx::Database>::Connection:
18        sqlx::Executor<'c, Database = Self::Database>,
19    i64: for<'q> sqlx::Encode<'q, Self::Database> + sqlx::Type<Self::Database>,
20    i32: for<'q> sqlx::Encode<'q, Self::Database> + sqlx::Type<Self::Database>,
21    String: for<'q> sqlx::Encode<'q, Self::Database> + sqlx::Type<Self::Database>,
22    bool: for<'q> sqlx::Encode<'q, Self::Database> + sqlx::Type<Self::Database>,
23    Vec<u8>: for<'q> sqlx::Encode<'q, Self::Database> + sqlx::Type<Self::Database>,
24{
25}
26
27#[cfg(feature = "sqlite")]
28impl FullDriver for crate::driver::SqliteDriver {}
29#[cfg(feature = "postgres")]
30impl FullDriver for crate::driver::PostgresDriver {}