use crate::model::DbBackendTypeMapper;
#[cfg(feature = "turso")]
pub mod turso_backend;
#[cfg(feature = "postgresql")]
pub mod postgresql_backend;
#[cfg(feature = "mysql")]
pub mod mysql_backend;
#[cfg(any(feature = "turso", feature = "postgresql", feature = "mysql"))]
pub mod connection_pool;
pub mod common_helpers;
#[macro_use]
pub mod macros;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum DbType {
#[cfg(feature = "turso")]
Turso,
#[cfg(feature = "postgresql")]
PostgreSQL,
#[cfg(feature = "mysql")]
MySQL,
}
impl DbType {
pub fn sql_type(
&self,
rust_type: &str,
is_primary: bool,
is_auto_increment: bool,
is_nullable: bool,
) -> String {
match self {
#[cfg(feature = "turso")]
DbType::Turso => crate::abstract_layer::turso_backend::TursoTypeMapper::sql_type(
rust_type,
is_primary,
is_auto_increment,
is_nullable,
),
#[cfg(feature = "postgresql")]
DbType::PostgreSQL => {
crate::abstract_layer::postgresql_backend::PostgreSQLTypeMapper::sql_type(
rust_type,
is_primary,
is_auto_increment,
is_nullable,
)
}
#[cfg(feature = "mysql")]
DbType::MySQL => crate::abstract_layer::mysql_backend::MySQLTypeMapper::sql_type(
rust_type,
is_primary,
is_auto_increment,
is_nullable,
),
}
}
}
#[cfg(any(feature = "turso", feature = "postgresql", feature = "mysql"))]
mod unified;
#[cfg(any(feature = "turso", feature = "postgresql", feature = "mysql"))]
pub use unified::{
AggregateFuture, CollectFuture, Database, DeleteExecutor, LeftJoinCollectFuture,
LeftJoinedSelectExecutor, MappedCollectFuture, MappedSelectExecutor, ModelCollectWithFuture,
RelatedCollectFuture, RelatedSelectExecutor, SelectExecutor, Transaction, UpdateExecutor,
};
#[cfg(any(feature = "turso", feature = "postgresql", feature = "mysql"))]
pub use connection_pool::{ConnectionPool, PooledConnection};