-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathlib.rs
More file actions
215 lines (182 loc) · 6.47 KB
/
lib.rs
File metadata and controls
215 lines (182 loc) · 6.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#![cfg_attr(docsrs, feature(doc_cfg))]
#![doc = include_str!("lib.md")]
#[cfg(all(
feature = "sqlite-preupdate-hook",
not(any(feature = "sqlite", feature = "sqlite-unbundled"))
))]
compile_error!(
"sqlite-preupdate-hook requires either 'sqlite' or 'sqlite-unbundled' to be enabled"
);
pub use sqlx_core::acquire::Acquire;
pub use sqlx_core::arguments::{Arguments, IntoArguments};
pub use sqlx_core::column::Column;
pub use sqlx_core::column::ColumnIndex;
pub use sqlx_core::column::ColumnOrigin;
pub use sqlx_core::connection::{ConnectOptions, Connection};
pub use sqlx_core::database::{self, Database};
pub use sqlx_core::describe::Describe;
pub use sqlx_core::executor::{Execute, Executor};
pub use sqlx_core::from_row::FromRow;
pub use sqlx_core::pool::{self, Pool};
#[doc(hidden)]
pub use sqlx_core::query::query_with_result as __query_with_result;
pub use sqlx_core::query::{query, query_with};
pub use sqlx_core::query_as::{query_as, query_as_with};
pub use sqlx_core::query_builder::{self, QueryBuilder};
#[doc(hidden)]
pub use sqlx_core::query_scalar::query_scalar_with_result as __query_scalar_with_result;
pub use sqlx_core::query_scalar::{query_scalar, query_scalar_with};
pub use sqlx_core::raw_sql::{raw_sql, RawSql};
pub use sqlx_core::row::Row;
pub use sqlx_core::sql_str::{AssertSqlSafe, SqlSafeStr, SqlStr};
pub use sqlx_core::statement::Statement;
pub use sqlx_core::transaction::Transaction;
pub use sqlx_core::type_info::TypeInfo;
pub use sqlx_core::types::Type;
pub use sqlx_core::value::{Value, ValueRef};
pub use sqlx_core::Either;
#[doc(inline)]
pub use sqlx_core::error::{self, Error, Result};
#[cfg(feature = "migrate")]
pub use sqlx_core::migrate;
#[cfg(feature = "mysql")]
#[cfg_attr(docsrs, doc(cfg(feature = "mysql")))]
#[doc(inline)]
pub use sqlx_mysql::{
self as mysql, MySql, MySqlConnection, MySqlExecutor, MySqlPool, MySqlTransaction,
};
#[cfg(feature = "postgres")]
#[cfg_attr(docsrs, doc(cfg(feature = "postgres")))]
#[doc(inline)]
pub use sqlx_postgres::{
self as postgres, PgConnection, PgExecutor, PgPool, PgTransaction, Postgres,
};
#[cfg(feature = "_sqlite")]
#[cfg_attr(docsrs, doc(cfg(feature = "_sqlite")))]
#[doc(inline)]
pub use sqlx_sqlite::{
self as sqlite, Sqlite, SqliteConnection, SqliteExecutor, SqlitePool, SqliteTransaction,
};
#[cfg(feature = "any")]
#[cfg_attr(docsrs, doc(cfg(feature = "any")))]
pub use crate::any::{reexports::*, Any, AnyExecutor};
#[cfg(any(feature = "derive", feature = "macros"))]
#[doc(hidden)]
pub extern crate sqlx_macros;
// derives
#[cfg(feature = "derive")]
#[doc(hidden)]
pub use sqlx_macros::{FromRow, Type};
// We can't do our normal facade approach with an attribute, but thankfully we can now
// have docs out-of-line quite easily.
#[doc = include_str!("macros/test.md")]
#[cfg(feature = "macros")]
pub use sqlx_macros::test;
#[doc(hidden)]
#[cfg(feature = "migrate")]
pub use sqlx_core::testing;
#[doc(hidden)]
pub use sqlx_core::rt::test_block_on;
#[cfg(feature = "any")]
pub mod any;
#[cfg(feature = "macros")]
mod macros;
// macro support
#[cfg(feature = "macros")]
#[doc(hidden)]
pub mod ty_match;
#[cfg(any(feature = "derive", feature = "macros"))]
#[doc(hidden)]
pub mod spec_error;
#[doc(hidden)]
pub use sqlx_core::rt as __rt;
/// Conversions between Rust and SQL types.
///
/// To see how each SQL type maps to a Rust type, see the corresponding `types` module for each
/// database:
///
/// * Postgres: [postgres::types]
/// * MySQL: [mysql::types]
/// * SQLite: [sqlite::types]
///
/// Any external types that have had [`Type`] implemented for, are re-exported in this module
/// for convenience as downstream users need to use a compatible version of the external crate
/// to take advantage of the implementation.
///
/// [`Type`]: types::Type
pub mod types {
pub use sqlx_core::types::*;
#[cfg(feature = "derive")]
#[doc(hidden)]
pub use sqlx_macros::Type;
}
/// Provides [`Encode`] for encoding values for the database.
pub mod encode {
pub use sqlx_core::encode::{Encode, IsNull};
#[cfg(feature = "derive")]
#[doc(hidden)]
pub use sqlx_macros::Encode;
}
pub use self::encode::Encode;
/// Provides [`Decode`] for decoding values from the database.
pub mod decode {
pub use sqlx_core::decode::Decode;
#[cfg(feature = "derive")]
#[doc(hidden)]
pub use sqlx_macros::Decode;
}
pub use self::decode::Decode;
/// Networking traits for custom transport implementations.
pub mod net {
pub use sqlx_core::io::ReadBuf;
pub use sqlx_core::net::Socket;
}
/// Types and traits for the `query` family of functions and macros.
pub mod query {
pub use sqlx_core::query::{Map, Query};
pub use sqlx_core::query_as::QueryAs;
pub use sqlx_core::query_scalar::QueryScalar;
}
/// Convenience re-export of common traits.
pub mod prelude {
pub use super::Acquire;
pub use super::ConnectOptions;
pub use super::Connection;
pub use super::Decode;
pub use super::Encode;
pub use super::Executor;
pub use super::FromRow;
pub use super::IntoArguments;
pub use super::Row;
pub use super::Statement;
pub use super::Type;
}
#[cfg(feature = "_unstable-docs")]
pub use sqlx_core::config as _config;
// NOTE: APIs exported in this module are SemVer-exempt.
#[doc(hidden)]
pub mod _unstable {
pub use sqlx_core::config;
}
#[doc(hidden)]
#[cfg_attr(
all(feature = "chrono", feature = "time"),
deprecated = "SQLx has both `chrono` and `time` features enabled, \
which presents an ambiguity when the `query!()` macros are mapping date/time types. \
The `query!()` macros prefer types from `time` by default, \
but this behavior should not be relied upon; \
to resolve the ambiguity, we recommend specifying the preferred crate in a `sqlx.toml` file: \
https://docs.rs/sqlx/latest/sqlx/config/macros/PreferredCrates.html#field.date_time"
)]
pub fn warn_on_ambiguous_inferred_date_time_crate() {}
#[doc(hidden)]
#[cfg_attr(
all(feature = "bigdecimal", feature = "rust_decimal"),
deprecated = "SQLx has both `bigdecimal` and `rust_decimal` features enabled, \
which presents an ambiguity when the `query!()` macros are mapping `NUMERIC`. \
The `query!()` macros prefer `bigdecimal::BigDecimal` by default, \
but this behavior should not be relied upon; \
to resolve the ambiguity, we recommend specifying the preferred crate in a `sqlx.toml` file: \
https://docs.rs/sqlx/latest/sqlx/config/macros/PreferredCrates.html#field.numeric"
)]
pub fn warn_on_ambiguous_inferred_numeric_crate() {}