1#![cfg_attr(
97 feature = "large-tables",
98 deprecated(
99 since = "1.2.0",
100 note = "The large-tables feature has been renamed to 32-column-tables"
101 )
102)]
103#![cfg_attr(
104 feature = "huge-tables",
105 deprecated(
106 since = "1.2.0",
107 note = "The huge-tables feature has been renamed to 64-column-tables"
108 )
109)]
110#![cfg_attr(
111 feature = "x32-column-tables",
112 deprecated(
113 since = "1.2.1",
114 note = "The x32-column-tables feature has been reanmed to 32-column-tables. The x was a workaround for a bug in crates.io that has since been resolved"
115 )
116)]
117#![cfg_attr(
118 feature = "x64-column-tables",
119 deprecated(
120 since = "1.2.1",
121 note = "The x64-column-tables feature has been reanmed to 64-column-tables. The x was a workaround for a bug in crates.io that has since been resolved"
122 )
123)]
124#![cfg_attr(
125 feature = "x128-column-tables",
126 deprecated(
127 since = "1.2.1",
128 note = "The x128-column-tables feature has been reanmed to 128-column-tables. The x was a workaround for a bug in crates.io that has since been resolved"
129 )
130)]
131#![cfg_attr(feature = "unstable", feature(specialization, try_from))]
132#![deny(
134 missing_debug_implementations,
135 missing_copy_implementations,
136 missing_docs
137)]
138#![allow(
140 clippy::option_map_unwrap_or_else,
141 clippy::option_map_unwrap_or,
142 clippy::match_same_arms,
143 clippy::type_complexity,
144 clippy::redundant_field_names,
145 unused_parens
147)]
148#![cfg_attr(test, allow(clippy::option_map_unwrap_or, clippy::result_unwrap_used))]
149#![warn(
150 clippy::option_unwrap_used,
151 clippy::result_unwrap_used,
152 clippy::print_stdout,
153 clippy::wrong_pub_self_convention,
154 clippy::mut_mut,
155 clippy::non_ascii_literal,
156 clippy::similar_names,
157 clippy::unicode_not_nfc,
158 clippy::enum_glob_use,
159 clippy::if_not_else,
160 clippy::items_after_statements,
161 clippy::used_underscore_binding
162)]
163
164#[cfg(feature = "postgres")]
165#[macro_use]
166extern crate bitflags;
167extern crate byteorder;
168#[macro_use]
169extern crate diesel_derives;
170#[doc(hidden)]
171pub use diesel_derives::*;
172
173#[macro_use]
174mod macros;
175
176#[cfg(test)]
177#[macro_use]
178extern crate cfg_if;
179
180#[cfg(test)]
181pub mod test_helpers;
182
183pub mod associations;
184pub mod backend;
185pub mod connection;
186pub mod data_types;
187pub mod deserialize;
188#[macro_use]
189pub mod expression;
190pub mod expression_methods;
191#[doc(hidden)]
192pub mod insertable;
193pub mod query_builder;
194pub mod query_dsl;
195pub mod query_source;
196#[cfg(feature = "r2d2")]
197pub mod r2d2;
198pub mod result;
199pub mod serialize;
200#[macro_use]
201pub mod sql_types;
202pub mod migration;
203pub mod row;
204pub mod types;
205
206#[cfg(feature = "mysql")]
207pub mod mysql;
208#[cfg(feature = "postgres")]
209pub mod pg;
210#[cfg(feature = "sqlite")]
211pub mod sqlite;
212
213mod type_impls;
214mod util;
215
216pub mod dsl {
217 #[doc(inline)]
221 pub use helper_types::*;
222
223 #[doc(inline)]
224 pub use expression::dsl::*;
225
226 #[doc(inline)]
227 pub use query_builder::functions::{
228 delete, insert_into, insert_or_ignore_into, replace_into, select, sql_query, update,
229 };
230}
231
232pub mod helper_types {
233 use super::query_builder::locking_clause as lock;
244 use super::query_dsl::methods::*;
245 use super::query_dsl::*;
246 use super::query_source::joins;
247
248 #[doc(inline)]
249 pub use expression::helper_types::*;
250
251 pub type Select<Source, Selection> = <Source as SelectDsl<Selection>>::Output;
253
254 pub type Filter<Source, Predicate> = <Source as FilterDsl<Predicate>>::Output;
256
257 pub type FindBy<Source, Column, Value> = Filter<Source, Eq<Column, Value>>;
259
260 #[cfg(feature = "with-deprecated")]
262 #[allow(deprecated)]
263 pub type ForUpdate<Source> = <Source as ForUpdateDsl>::Output;
264
265 #[cfg(not(feature = "with-deprecated"))]
267 pub type ForUpdate<Source> = <Source as LockingDsl<lock::ForUpdate>>::Output;
268
269 pub type ForNoKeyUpdate<Source> = <Source as LockingDsl<lock::ForNoKeyUpdate>>::Output;
271
272 pub type ForShare<Source> = <Source as LockingDsl<lock::ForShare>>::Output;
274
275 pub type ForKeyShare<Source> = <Source as LockingDsl<lock::ForKeyShare>>::Output;
277
278 pub type SkipLocked<Source> = <Source as ModifyLockDsl<lock::SkipLocked>>::Output;
280
281 pub type NoWait<Source> = <Source as ModifyLockDsl<lock::NoWait>>::Output;
283
284 pub type Find<Source, PK> = <Source as FindDsl<PK>>::Output;
286
287 pub type OrFilter<Source, Predicate> = <Source as OrFilterDsl<Predicate>>::Output;
289
290 pub type Order<Source, Ordering> = <Source as OrderDsl<Ordering>>::Output;
292
293 pub type ThenOrderBy<Source, Ordering> = <Source as ThenOrderDsl<Ordering>>::Output;
295
296 pub type Limit<Source> = <Source as LimitDsl>::Output;
298
299 pub type Offset<Source> = <Source as OffsetDsl>::Output;
301
302 pub type InnerJoin<Source, Rhs> =
304 <Source as JoinWithImplicitOnClause<Rhs, joins::Inner>>::Output;
305
306 pub type LeftJoin<Source, Rhs> =
308 <Source as JoinWithImplicitOnClause<Rhs, joins::LeftOuter>>::Output;
309
310 use super::associations::HasTable;
311 use super::query_builder::{AsChangeset, IntoUpdateTarget, UpdateStatement};
312 pub type Update<Target, Changes> = UpdateStatement<
314 <Target as HasTable>::Table,
315 <Target as IntoUpdateTarget>::WhereClause,
316 <Changes as AsChangeset>::Changeset,
317 >;
318
319 pub type IntoBoxed<'a, Source, DB> = <Source as BoxedDsl<'a, DB>>::Output;
321
322 pub type Distinct<Source> = <Source as DistinctDsl>::Output;
324
325 #[cfg(feature = "postgres")]
327 pub type DistinctOn<Source, Expr> = <Source as DistinctOnDsl<Expr>>::Output;
328
329 pub type SingleValue<Source> = <Source as SingleValueDsl>::Output;
331
332 pub type NullableSelect<Source> = <Source as SelectNullableDsl>::Output;
334}
335
336pub mod prelude {
337 pub use associations::{GroupedBy, Identifiable};
339 pub use connection::Connection;
340 #[deprecated(
341 since = "1.1.0",
342 note = "Explicitly `use diesel::deserialize::Queryable"
343 )]
344 pub use deserialize::Queryable;
345 pub use expression::{
346 AppearsOnTable, BoxableExpression, Expression, IntoSql, SelectableExpression,
347 };
348 pub use expression_methods::*;
349 #[doc(inline)]
350 pub use insertable::Insertable;
351 #[doc(hidden)]
352 pub use query_dsl::GroupByDsl;
353 pub use query_dsl::{BelongingToDsl, JoinOnDsl, QueryDsl, RunQueryDsl, SaveChangesDsl};
354
355 pub use query_source::{Column, JoinTo, QuerySource, Table};
356 pub use result::{ConnectionError, ConnectionResult, OptionalExtension, QueryResult};
357
358 #[cfg(feature = "mysql")]
359 pub use mysql::MysqlConnection;
360 #[cfg(feature = "postgres")]
361 pub use pg::PgConnection;
362 #[cfg(feature = "sqlite")]
363 pub use sqlite::SqliteConnection;
364}
365
366pub use prelude::*;
367#[doc(inline)]
368pub use query_builder::debug_query;
369#[doc(inline)]
370pub use query_builder::functions::{
371 delete, insert_into, insert_or_ignore_into, replace_into, select, sql_query, update,
372};
373pub use result::Error::NotFound;
374
375pub(crate) mod diesel {
376 pub use super::*;
377}