extern crate self as yang_db;
pub mod capability;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub mod error;
pub mod isolation;
mod pool;
mod row_lock;
mod reference;
#[cfg(any(feature = "mysql", feature = "postgres"))]
mod dialect;
#[cfg(any(feature = "mysql", feature = "postgres"))]
mod json_param;
#[cfg(feature = "mysql")]
pub mod mysql;
#[cfg(feature = "postgres")]
pub mod postgres;
#[cfg(feature = "redis")]
pub mod redis;
mod sql_types;
pub use capability::{
BackendCapabilities, BackendCapability, BackendKind, PlaceholderStyle, SafetyConstraint,
MYSQL_CAPABILITIES, POSTGRES_CAPABILITIES, REDIS_CAPABILITIES,
};
pub use error::{DbError, DbErrorCategory};
pub use isolation::IsolationLevel;
pub use pool::PoolStatus;
#[doc(hidden)]
pub use reference::{__validate_field_literal, __validate_table_literal};
pub use reference::{CompareOp, FieldRef, Predicate, SelectExpr, SortOrder, SqlExpr, TableRef};
#[macro_export]
macro_rules! table {
($value:literal) => {{
const _: () = $crate::__validate_table_literal($value);
static VALUE: std::sync::OnceLock<$crate::TableRef> = std::sync::OnceLock::new();
VALUE.get_or_init(|| $crate::TableRef::__from_validated_literal($value))
}};
}
#[macro_export]
macro_rules! field {
($value:literal) => {{
const _: () = $crate::__validate_field_literal($value);
static VALUE: std::sync::OnceLock<$crate::FieldRef> = std::sync::OnceLock::new();
VALUE.get_or_init(|| $crate::FieldRef::__from_validated_literal($value))
}};
}
pub use row_lock::RowLock;
#[allow(deprecated)]
#[cfg(feature = "mysql")]
pub use mysql::{
condition_to_sql_owned, condition_to_sql_owned_checked, quote_identifier, quote_qualified,
Condition, Database, DatabaseConfig, FieldType, QueryBuilder, SqlValue, Transaction,
};
#[allow(deprecated)]
#[cfg(feature = "postgres")]
pub use postgres::{
condition_to_sql_owned as pg_condition_to_sql_owned,
condition_to_sql_owned_checked as pg_condition_to_sql_owned_checked, Condition as PgCondition,
Database as PgDatabase, DatabaseConfig as PgDatabaseConfig, FieldType as PgFieldType,
QueryBuilder as PgQueryBuilder, SqlValue as PgSqlValue, Transaction as PgTransaction,
};
#[cfg(feature = "redis")]
pub use redis::{RedisClient, RedisConfig, RedisPipeline, RedisTransaction, RedisValue};
pub type Result<T> = std::result::Result<T, DbError>;