| 1 | #![cfg_attr(docsrs, feature(doc_cfg))] |
| 2 | #![doc = include_str!("lib.md")] |
| 3 | |
| 4 | pub use sqlx_core::acquire::Acquire; |
| 5 | pub use sqlx_core::arguments::{Arguments, IntoArguments}; |
| 6 | pub use sqlx_core::column::Column; |
| 7 | pub use sqlx_core::column::ColumnIndex; |
| 8 | pub use sqlx_core::connection::{ConnectOptions, Connection}; |
| 9 | pub use sqlx_core::database::{self, Database}; |
| 10 | pub use sqlx_core::describe::Describe; |
| 11 | pub use sqlx_core::executor::{Execute, Executor}; |
| 12 | pub use sqlx_core::from_row::FromRow; |
| 13 | pub use sqlx_core::pool::{self, Pool}; |
| 14 | #[doc(hidden)] |
| 15 | pub use sqlx_core::query::query_with_result as __query_with_result; |
| 16 | pub use sqlx_core::query::{query, query_with}; |
| 17 | pub use sqlx_core::query_as::{query_as, query_as_with}; |
| 18 | pub use sqlx_core::query_builder::{self, QueryBuilder}; |
| 19 | #[doc(hidden)] |
| 20 | pub use sqlx_core::query_scalar::query_scalar_with_result as __query_scalar_with_result; |
| 21 | pub use sqlx_core::query_scalar::{query_scalar, query_scalar_with}; |
| 22 | pub use sqlx_core::raw_sql::{raw_sql, RawSql}; |
| 23 | pub use sqlx_core::row::Row; |
| 24 | pub use sqlx_core::statement::Statement; |
| 25 | pub use sqlx_core::transaction::{Transaction, TransactionManager}; |
| 26 | pub use sqlx_core::type_info::TypeInfo; |
| 27 | pub use sqlx_core::types::Type; |
| 28 | pub use sqlx_core::value::{Value, ValueRef}; |
| 29 | pub use sqlx_core::Either; |
| 30 | |
| 31 | #[doc(inline)] |
| 32 | pub use sqlx_core::error::{self, Error, Result}; |
| 33 | |
| 34 | #[cfg(feature = "migrate")] |
| 35 | pub use sqlx_core::migrate; |
| 36 | |
| 37 | #[cfg(feature = "mysql")] |
| 38 | #[cfg_attr(docsrs, doc(cfg(feature = "mysql")))] |
| 39 | #[doc(inline)] |
| 40 | pub use sqlx_mysql::{ |
| 41 | self as mysql, MySql, MySqlConnection, MySqlExecutor, MySqlPool, MySqlTransaction, |
| 42 | }; |
| 43 | |
| 44 | #[cfg(feature = "postgres")] |
| 45 | #[cfg_attr(docsrs, doc(cfg(feature = "postgres")))] |
| 46 | #[doc(inline)] |
| 47 | pub use sqlx_postgres::{ |
| 48 | self as postgres, PgConnection, PgExecutor, PgPool, PgTransaction, Postgres, |
| 49 | }; |
| 50 | |
| 51 | #[cfg(feature = "_sqlite")] |
| 52 | #[cfg_attr(docsrs, doc(cfg(feature = "_sqlite")))] |
| 53 | #[doc(inline)] |
| 54 | pub use sqlx_sqlite::{ |
| 55 | self as sqlite, Sqlite, SqliteConnection, SqliteExecutor, SqlitePool, SqliteTransaction, |
| 56 | }; |
| 57 | |
| 58 | #[cfg(feature = "any")] |
| 59 | #[cfg_attr(docsrs, doc(cfg(feature = "any")))] |
| 60 | pub use crate::any::{reexports::*, Any, AnyExecutor}; |
| 61 | |
| 62 | #[cfg(any(feature = "derive", feature = "macros"))] |
| 63 | #[doc(hidden)] |
| 64 | pub extern crate sqlx_macros; |
| 65 | |
| 66 | // derives |
| 67 | #[cfg(feature = "derive")] |
| 68 | #[doc(hidden)] |
| 69 | pub use sqlx_macros::{FromRow, Type}; |
| 70 | |
| 71 | // We can't do our normal facade approach with an attribute, but thankfully we can now |
| 72 | // have docs out-of-line quite easily. |
| 73 | #[doc = include_str!("macros/test.md")] |
| 74 | #[cfg(feature = "macros")] |
| 75 | pub use sqlx_macros::test; |
| 76 | |
| 77 | #[doc(hidden)] |
| 78 | #[cfg(feature = "migrate")] |
| 79 | pub use sqlx_core::testing; |
| 80 | |
| 81 | #[doc(hidden)] |
| 82 | pub use sqlx_core::rt::test_block_on; |
| 83 | |
| 84 | #[cfg(feature = "any")] |
| 85 | pub mod any; |
| 86 | |
| 87 | #[cfg(feature = "macros")] |
| 88 | mod macros; |
| 89 | |
| 90 | // macro support |
| 91 | #[cfg(feature = "macros")] |
| 92 | #[doc(hidden)] |
| 93 | pub mod ty_match; |
| 94 | |
| 95 | #[cfg(feature = "macros")] |
| 96 | #[doc(hidden)] |
| 97 | pub mod spec_error; |
| 98 | |
| 99 | #[doc(hidden)] |
| 100 | pub use sqlx_core::rt as __rt; |
| 101 | |
| 102 | /// Conversions between Rust and SQL types. |
| 103 | /// |
| 104 | /// To see how each SQL type maps to a Rust type, see the corresponding `types` module for each |
| 105 | /// database: |
| 106 | /// |
| 107 | /// * Postgres: [postgres::types] |
| 108 | /// * MySQL: [mysql::types] |
| 109 | /// * SQLite: [sqlite::types] |
| 110 | /// |
| 111 | /// Any external types that have had [`Type`] implemented for, are re-exported in this module |
| 112 | /// for convenience as downstream users need to use a compatible version of the external crate |
| 113 | /// to take advantage of the implementation. |
| 114 | /// |
| 115 | /// [`Type`]: types::Type |
| 116 | pub mod types { |
| 117 | pub use sqlx_core::types::*; |
| 118 | |
| 119 | #[cfg(feature = "derive")] |
| 120 | #[doc(hidden)] |
| 121 | pub use sqlx_macros::Type; |
| 122 | } |
| 123 | |
| 124 | /// Provides [`Encode`] for encoding values for the database. |
| 125 | pub mod encode { |
| 126 | pub use sqlx_core::encode::{Encode, IsNull}; |
| 127 | |
| 128 | #[cfg(feature = "derive")] |
| 129 | #[doc(hidden)] |
| 130 | pub use sqlx_macros::Encode; |
| 131 | } |
| 132 | |
| 133 | pub use self::encode::Encode; |
| 134 | |
| 135 | /// Provides [`Decode`] for decoding values from the database. |
| 136 | pub mod decode { |
| 137 | pub use sqlx_core::decode::Decode; |
| 138 | |
| 139 | #[cfg(feature = "derive")] |
| 140 | #[doc(hidden)] |
| 141 | pub use sqlx_macros::Decode; |
| 142 | } |
| 143 | |
| 144 | pub use self::decode::Decode; |
| 145 | |
| 146 | /// Types and traits for the `query` family of functions and macros. |
| 147 | pub mod query { |
| 148 | pub use sqlx_core::query::{Map, Query}; |
| 149 | pub use sqlx_core::query_as::QueryAs; |
| 150 | pub use sqlx_core::query_scalar::QueryScalar; |
| 151 | } |
| 152 | |
| 153 | /// Convenience re-export of common traits. |
| 154 | pub mod prelude { |
| 155 | pub use super::Acquire; |
| 156 | pub use super::ConnectOptions; |
| 157 | pub use super::Connection; |
| 158 | pub use super::Decode; |
| 159 | pub use super::Encode; |
| 160 | pub use super::Executor; |
| 161 | pub use super::FromRow; |
| 162 | pub use super::IntoArguments; |
| 163 | pub use super::Row; |
| 164 | pub use super::Statement; |
| 165 | pub use super::Type; |
| 166 | } |