extern crate self as yang_db;
pub mod capability;
pub mod backend_api;
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 backend_api::Backend;
pub use capability::{
BackendCapabilities, BackendCapability, BackendKind, PlaceholderStyle, SafetyConstraint,
MYSQL_CAPABILITIES, POSTGRES_CAPABILITIES, REDIS_CAPABILITIES,
};
pub use error::{
DbError, DbErrorCategory, RedisErrorInfo, RedisErrorKind, RedisRetryMethod, SqlErrorInfo,
SqlErrorKind,
};
pub use isolation::IsolationLevel;
pub use pool::PoolStatus;
#[doc(hidden)]
pub use reference::{__validate_field_literal, __validate_table_literal};
pub use reference::{
CompareOp, ExprOperand, FieldRef, Predicate, SelectExpr, SortOrder, SqlExpr, SqlExprParam,
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,
CancelToken as PgCancelToken, Condition as PgCondition, Database as PgDatabase,
DatabaseConfig as PgDatabaseConfig, FieldType as PgFieldType, Notification as PgNotification,
PgAdvisoryLock, PgNotificationListener, PgRowCursor, QueryBuilder as PgQueryBuilder,
SqlValue as PgSqlValue, SslMode as PgSslMode, Transaction as PgTransaction,
TransactionOptions as PgTransactionOptions,
};
#[cfg(feature = "redis")]
pub use ::redis as redis_crate;
#[cfg(feature = "redis")]
pub use redis::{
GetExOption, JsonCodec, KeyNamespace, RedisClient, RedisCodec, RedisConfig, RedisHealth,
RedisLock, RedisLockGuard, RedisMessage, RedisPipeline, RedisPubSub, RedisTopology,
RedisTransaction, RedisValue, SetOptions, SetOutcome, XReadGroupOptions, ZAddOptions,
};
pub type Result<T> = std::result::Result<T, DbError>;