#![cfg_attr(feature = "sqlite", doc = include_str!("../README.md"))]
mod ast;
pub mod compiler;
pub mod decode;
pub mod drivers;
pub mod error;
pub mod executor;
pub mod expression;
pub mod function;
pub mod migration;
pub mod query;
pub mod schema;
pub mod value;
pub mod window;
pub use compiler::{CompiledQuery, Dialect, MysqlDialect, PostgresDialect, SqliteDialect};
pub use decode::{DecodeError, FromRow, FromValue, Row};
#[cfg(feature = "postgres")]
pub use drivers::postgres::{
PostgresError, PostgresExecutor, PostgresIsolationLevel, PostgresMigrationError,
PostgresMigrationOptions, PostgresOptionsError, PostgresPoolHealth,
PostgresPoolMetricsSnapshot, PostgresPoolOptions, PostgresPoolStatus, PostgresRetryClass,
PostgresRow, PostgresTlsError, PostgresTlsOptions, PostgresTransaction,
PostgresTransactionAccessMode, PostgresTransactionError, PostgresTransactionOptions,
};
#[cfg(feature = "sqlite")]
pub use drivers::sqlite::{
SqliteError, SqliteExecutor, SqliteJournalMode, SqliteMigrationError, SqliteOptions, SqliteRow,
SqliteSavepoint, SqliteSavepointError, SqliteTransaction, SqliteTransactionError,
};
pub use error::{Error, Result};
pub use executor::{
Database, DatabaseError, ExecuteResult, Executor, QueryResult, Transaction, TransactionManager,
};
pub use expression::{
exists, not, Column, Expression, OrderDirection, SelectionExt, SqlComparable, SqlNumeric,
WindowBoundary, WindowFrame, WindowFrameUnits,
};
pub use function::{
bound, cast, coalesce, count, count_all, least, max, min, scalar_subquery, sql_function,
TypedExpression,
};
pub use migration::{
pending_migrations, AppliedMigration, Migration, MigrationBackend, MigrationError,
MigrationLedger, MigrationReport, Migrator, PreparedMigration,
};
pub use query::{
delete_from, insert_into, lock_table, select_from, select_from_as, sql_query, update_table,
ConflictTarget, InsertRow, PostgresTableLockMode, Query, SqlQuery, TableLockQuery,
};
pub use schema::{Table, TableRef};
pub use value::{IntoSqlValue, SqlArray, Value};
pub use window::{dense_rank, rank, row_number, WindowExpression};
#[macro_export]
macro_rules! orm_table {
(
$(#[$table_meta:meta])*
$visibility:vis struct $table:ident => $table_name:literal {
$(
$(#[$column_meta:meta])*
$column:ident : $value:ty => $column_name:literal
),* $(,)?
}
) => {
$(#[$table_meta])*
#[derive(Debug, Clone, Copy, Default)]
$visibility struct $table;
impl $crate::Table for $table {
const NAME: &'static str = $table_name;
}
impl $table {
$(
$(#[$column_meta])*
$visibility const fn $column() -> $crate::Column<$table, $value> {
$crate::Column::new($table_name, $column_name)
}
)*
}
};
}