1#![cfg_attr(not(feature = "std"), no_std)]
2//! # Diesel
3//!
4//! Diesel is an ORM and query builder designed to reduce the boilerplate for database interactions.
5//! If this is your first time reading this documentation,
6//! we recommend you start with the [getting started guide].
7//! We also have [many other long form guides].
8//!
9//! [getting started guide]: https://diesel.rs/guides/getting-started/
10//! [many other long form guides]: https://diesel.rs/guides
11//!
12//! # Where to find things
13//!
14//! ## Declaring your schema
15//!
16//! For Diesel to validate your queries at compile time
17//! it requires you to specify your schema in your code,
18//! which you can do with [the `table!` macro][`table!`].
19//! `diesel print-schema` can be used
20//! to automatically generate these macro calls
21//! (by connecting to your database and querying its schema).
22//!
23//!
24//! ## Getting started
25//!
26//! Queries usually start from either a table, or a function like [`update`].
27//! Those functions can be found [here](#functions).
28//!
29//! Diesel provides a [`prelude` module](prelude),
30//! which exports most of the typically used traits and types.
31//! We are conservative about what goes in this module,
32//! and avoid anything which has a generic name.
33//! Files which use Diesel are expected to have `use diesel::prelude::*;`.
34//!
35//! [`update`]: update()
36//!
37//! ## Constructing a query
38//!
39//! The tools the query builder gives you can be put into these three categories:
40//!
41//! - "Query builder methods" are things that map to portions of a whole query
42//! (such as `ORDER` and `WHERE`). These methods usually have the same name
43//! as the SQL they map to, except for `WHERE` which is called `filter` in Diesel
44//! (To not conflict with the Rust keyword).
45//! These methods live in [the `query_dsl` module](query_dsl).
46//! - "Expression methods" are things you would call on columns
47//! or other individual values.
48//! These methods live in [the `expression_methods` module](expression_methods)
49//! You can often find these by thinking "what would this be called"
50//! if it were a method
51//! and typing that into the search bar
52//! (e.g. `LIKE` is called `like` in Diesel).
53//! Most operators are named based on the Rust function which maps to that
54//! operator in [`std::ops`][]
55//! (For example `==` is called `.eq`, and `!=` is called `.ne`).
56//! - "Bare functions" are normal SQL functions
57//! such as `sum`.
58//! They live in [the `dsl` module](dsl).
59//! Diesel only supports a very small number of these functions.
60//! You can declare additional functions you want to use
61//! with [the `define_sql_function!` macro][`define_sql_function!`].
62//!
63//! [`std::ops`]: //doc.rust-lang.org/stable/std/ops/index.html
64//!
65//! ## Serializing and Deserializing
66//!
67//! Types which represent the result of a SQL query implement
68//! a trait called [`Queryable`].
69//!
70//! Diesel maps "Rust types" (e.g. `i32`) to and from "SQL types"
71//! (e.g. [`diesel::sql_types::Integer`]).
72//! You can find all the types supported by Diesel in [the `sql_types` module](sql_types).
73//! These types are only used to represent a SQL type.
74//! You should never put them on your `Queryable` structs.
75//!
76//! To find all the Rust types which can be used with a given SQL type,
77//! see the documentation for that SQL type.
78//!
79//! To find all the SQL types which can be used with a Rust type,
80//! go to the docs for either [`ToSql`] or [`FromSql`],
81//! go to the "Implementors" section,
82//! and find the Rust type you want to use.
83//!
84//! [`Queryable`]: deserialize::Queryable
85//! [`diesel::sql_types::Integer`]: sql_types::Integer
86//! [`ToSql`]: serialize::ToSql
87//! [`FromSql`]: deserialize::FromSql
88//!
89//! ## How to read diesels compile time error messages
90//!
91//! Diesel is known for generating large complicated looking errors. Usually
92//! most of these error messages can be broken down easily. The following
93//! section tries to give an overview of common error messages and how to read them.
94//! As a general note it's always useful to read the complete error message as emitted
95//! by rustc, including the `required because of …` part of the message.
96//! Your IDE might hide important parts!
97//!
98//! The following error messages are common:
99//!
100//! * `the trait bound (diesel::sql_types::Integer, …, diesel::sql_types::Text): load_dsl::private::CompatibleType<YourModel, Pg> is not satisfied`
101//! while trying to execute a query:
102//! This error indicates a mismatch between what your query returns and what your model struct
103//! expects the query to return. The fields need to match in terms of field order, field type
104//! and field count. If you are sure that everything matches, double check the enabled diesel
105//! features (for support for types from other crates) and double check (via `cargo tree`)
106//! that there is only one version of such a shared crate in your dependency tree.
107//! Consider using [`#[derive(Selectable)]`](derive@crate::prelude::Selectable) +
108//! `#[diesel(check_for_backend(diesel::pg::Pg))]`
109//! to improve the generated error message.
110//! * `the trait bound i32: diesel::Expression is not satisfied` in the context of `Insertable`
111//! model structs:
112//! This error indicates a type mismatch between the field you are trying to insert into the database
113//! and the actual database type. These error messages contain a line
114//! like ` = note: required for i32 to implement AsExpression<diesel::sql_types::Text>`
115//! that show both the provided rust side type (`i32` in that case) and the expected
116//! database side type (`Text` in that case).
117//! * `the trait bound i32: AppearsOnTable<users::table> is not satisfied` in the context of `AsChangeset`
118//! model structs:
119//! This error indicates a type mismatch between the field you are trying to update and the actual
120//! database type. Double check your type mapping.
121//! * `the trait bound SomeLargeType: QueryFragment<Sqlite, SomeMarkerType> is not satisfied` while
122//! trying to execute a query.
123//! This error message indicates that a given query is not supported by your backend. This usually
124//! means that you are trying to use SQL features from one SQL dialect on a different database
125//! system. Double check your query that everything required is supported by the selected
126//! backend. If that's the case double check that the relevant feature flags are enabled
127//! (for example, `returning_clauses_for_sqlite_3_35` for enabling support for returning clauses in newer
128//! sqlite versions)
129//! * `the trait bound posts::title: SelectableExpression<users::table> is not satisfied` while
130//! executing a query:
131//! This error message indicates that you're trying to select a field from a table
132//! that does not appear in your from clause. If your query joins the relevant table via
133//! [`left_join`](crate::query_dsl::QueryDsl::left_join) you need to call
134//! [`.nullable()`](crate::expression_methods::NullableExpressionMethods::nullable)
135//! on the relevant column in your select clause.
136//!
137//!
138//! ## Getting help
139//!
140//! If you run into problems, Diesel has an active community.
141//! Open a new [discussion] thread at diesel github repository
142//! and we will try to help you
143//!
144//! [discussion]: https://github.com/diesel-rs/diesel/discussions/categories/q-a
145//!
146//! # Crate feature flags
147//!
148//! The following feature flags are considered to be part of diesels public
149//! API. Any feature flag that is not listed here is **not** considered to
150//! be part of the public API and can disappear at any point in time:
151152//!
153//! - `sqlite`: This feature enables the diesel sqlite backend. Enabling this feature requires per default
154//! a compatible copy of `libsqlite3` for your target architecture. Alternatively, you can add `libsqlite3-sys`
155//! with the `bundled` feature as a dependency to your crate so SQLite will be bundled:
156//! ```toml
157//! [dependencies]
158//! libsqlite3-sys = { version = "0.29", features = ["bundled"] }
159//! ```
160//! - `sqlite-no-std` A diesel sqlite backend for no-std environments. This is mostly the same as the `sqlite` backend,
161//! but it doesn't enable the `std` feature flag
162//! - `postgres`: This feature enables the diesel postgres backend. This features implies `postgres_backend`
163//! Enabling this feature requires a compatible copy of `libpq` for your target architecture.
164//! Alternatively, you can add `pq-sys` with the `bundled` feature as a dependency to your
165//! crate so libpq will be bundled:
166//! ```toml
167//! [dependencies]
168//! pq-sys = { version = "0.6", features = ["bundled"] }
169//! openssl-sys = { version = "0.9.100", features = ["vendored"] }
170//! ```
171//! - `mysql`: This feature enables the diesel mysql backend. This feature implies `mysql_backend`.
172//! Enabling this feature requires a compatible copy of `libmysqlclient` for your target architecture.
173//! Alternatively, you can add `mysqlclient-sys` with the `bundled` feature as a dependency to your
174//! crate so libmysqlclient will be bundled:
175//! ```toml
176//! [dependencies]
177//! mysqlclient-sys = { version = "0.5", features = ["bundled"] }
178//! openssl-sys = { version = "0.9.100", features = ["vendored"] }
179//! ```
180//! - `postgres_backend`: This feature enables those parts of diesels postgres backend, that are not dependent
181//! on `libpq`. Diesel does not provide any connection implementation with only this feature enabled.
182//! This feature can be used to implement a custom implementation of diesels `Connection` trait for the
183//! postgres backend outside of diesel itself, while reusing the existing query dsl extensions for the
184//! postgres backend
185//! - `mysql_backend`: This feature enables those parts of diesels mysql backend, that are not dependent
186//! on `libmysqlclient`. Diesel does not provide any connection implementation with only this feature enabled.
187//! This feature can be used to implement a custom implementation of diesels `Connection` trait for the
188//! mysql backend outside of diesel itself, while reusing the existing query dsl extensions for the
189//! mysql backend
190//! - `returning_clauses_for_sqlite_3_35`: This feature enables support for `RETURNING` clauses in the sqlite backend.
191//! Enabling this feature requires sqlite 3.35.0 or newer.
192//! - `32-column-tables`: This feature enables support for tables with up to 32 columns.
193//! This feature is enabled by default. Consider disabling this feature if you write a library crate
194//! providing general extensions for diesel or if you do not need to support tables with more than 16 columns
195//! and you want to minimize your compile times.
196//! - `64-column-tables`: This feature enables support for tables with up to 64 columns. It implies the
197//! `32-column-tables` feature. Enabling this feature will increase your compile times.
198//! - `128-column-tables`: This feature enables support for tables with up to 128 columns. It implies the
199//! `64-column-tables` feature. Enabling this feature will increase your compile times significantly.
200//! - `custom-count-column-tables`: This feature allows to customize the number of columns
201//! supported by diesel by setting the `DIESEL_MAX_COLUMN_COUNT` environment variable to the desired
202//! value. It is meant to be used if the other `*-column-tables` features do not fit your use-case.
203//! Keep in mind that larger values increase the compile times for Diesel significantly.
204//! For a greater convenience this environment variable can also be set in a `.cargo/config.toml`
205//! file as described in the [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env).
206//! - `i-implement-a-third-party-backend-and-opt-into-breaking-changes`: This feature opens up some otherwise
207//! private API, that can be useful to implement a third party [`Backend`](crate::backend::Backend)
208//! or write a custom [`Connection`] implementation. **Do not use this feature for
209//! any other usecase**. By enabling this feature you explicitly opt out diesel stability guarantees. We explicitly
210//! reserve us the right to break API's exported under this feature flag in any upcoming minor version release.
211//! If you publish a crate depending on this feature flag consider to restrict the supported diesel version to the
212//! currently released minor version.
213//! - `serde_json`: This feature flag enables support for (de)serializing json values from the database using
214//! types provided by `serde_json`.
215//! - `chrono`: This feature flags enables support for (de)serializing date/time values from the database using
216//! types provided by `chrono`
217//! - `uuid`: This feature flag enables support for (de)serializing uuid values from the database using types
218//! provided by `uuid`
219//! - `network-address`: This feature flag enables support for (de)serializing
220//! IP values from the database using types provided by `ipnetwork`.
221//! - `ipnet-address`: This feature flag enables support for (de)serializing IP
222//! values from the database using types provided by `ipnet`.
223//! - `numeric`: This feature flag enables support for (de)serializing numeric values from the database using types
224//! provided by `bigdecimal`
225//! - `r2d2`: This feature flag enables support for the `r2d2` connection pool implementation.
226//! - `extras`: This feature enables the feature flagged support for any third party crate. This implies the
227//! following feature flags: `serde_json`, `chrono`, `uuid`, `network-address`, `numeric`, `r2d2`
228//! - `with-deprecated`: This feature enables items marked as `#[deprecated]`. It is enabled by default.
229//! disabling this feature explicitly opts out diesels stability guarantee.
230//! - `without-deprecated`: This feature disables any item marked as `#[deprecated]`. Enabling this feature
231//! explicitly opts out the stability guarantee given by diesel. This feature overrides the `with-deprecated`.
232//! Note that this may also remove items that are not shown as `#[deprecated]` in our documentation, due to
233//! various bugs in rustdoc. It can be used to check if you depend on any such hidden `#[deprecated]` item.
234//! - `std`: This features enables usage of the rust standard library. When disabled Diesel will only use the `core`
235//! and `alloc` crate instead. If this feature is disabled it is required to enable the `hashbrown` feature.
236//! - `hashbrown`: This feature enables an optional dependency on the hashbrown crate. It's required for usage in `no_std`
237//! environments.
238//!
239//! By default the following features are enabled:
240//!
241//! - `with-deprecated`
242//! - `32-column-tables`
243//! - `std`
244245#![cfg_attr(feature = "unstable", feature(trait_alias))]
246#![cfg_attr(feature = "unstable", feature(strict_provenance_lints))]
247#![cfg_attr(
248 feature = "unstable",
249 warn(fuzzy_provenance_casts, lossy_provenance_casts)
250)]
251#![cfg_attr(diesel_docsrs, feature(doc_cfg, rustdoc_internals))]
252#![cfg_attr(diesel_docsrs, expect(internal_features))]
253#![cfg_attr(feature = "128-column-tables", recursion_limit = "256")]
254// Built-in Lints
255#![warn(
256 unreachable_pub,
257 missing_debug_implementations,
258 missing_copy_implementations,
259 elided_lifetimes_in_paths,
260 missing_docs
261)]
262// Clippy lints
263#![allow(
264 clippy::match_same_arms,
265 clippy::needless_doctest_main,
266 clippy::map_unwrap_or,
267 clippy::redundant_field_names,
268 clippy::type_complexity
269)]
270#![warn(
271 clippy::unwrap_used,
272 clippy::print_stdout,
273 clippy::mut_mut,
274 clippy::non_ascii_literal,
275 clippy::similar_names,
276 clippy::unicode_not_nfc,
277 clippy::enum_glob_use,
278 clippy::if_not_else,
279 clippy::items_after_statements,
280 clippy::used_underscore_binding,
281 clippy::cast_possible_wrap,
282 clippy::cast_possible_truncation,
283 clippy::cast_sign_loss
284)]
285#![cfg_attr(
286 not(test),
287 warn(clippy::std_instead_of_alloc, clippy::std_instead_of_core)
288)]
289#![deny(unsafe_code)]
290#![cfg_attr(test, allow(clippy::unwrap_used))]
291292// the no-std version needs hashbrown
293#[cfg(all(not(feature = "hashbrown"), not(feature = "std")))]
294compile_error!("The hashbrown feature is required for no-std support");
295296extern crate alloc;
297extern crate core;
298extern crate diesel_derives;
299300#[macro_use]
301#[doc(hidden)]
302pub mod macros;
303#[doc(hidden)]
304pub mod internal;
305306#[cfg(test)]
307#[macro_use]
308extern crate cfg_if;
309310#[cfg(test)]
311pub mod test_helpers;
312313pub mod associations;
314pub mod backend;
315pub mod collation;
316pub mod connection;
317pub mod data_types;
318pub mod deserialize;
319#[macro_use]
320pub mod expression;
321pub mod expression_methods;
322#[doc(hidden)]
323pub mod insertable;
324pub mod query_builder;
325pub mod query_dsl;
326pub mod query_source;
327#[cfg(feature = "r2d2")]
328pub mod r2d2;
329pub mod result;
330pub mod serialize;
331pub mod upsert;
332#[macro_use]
333pub mod sql_types;
334pub mod migration;
335pub mod row;
336337#[cfg(feature = "mysql_backend")]
338pub mod mysql;
339#[cfg(feature = "postgres_backend")]
340pub mod pg;
341#[cfg(feature = "__sqlite-shared")]
342pub mod sqlite;
343344#[macro_use]
345mod reexport_ambiguities;
346mod type_impls;
347pub mod types;
348mod util;
349350#[doc(hidden)]
351#[cfg(all(feature = "with-deprecated", not(feature = "without-deprecated")))]
352#[deprecated(since = "2.0.0", note = "Use explicit macro imports instead")]
353pub use diesel_derives::{
354AsChangeset, AsExpression, Associations, DieselNumericOps, FromSqlRow, Identifiable,
355Insertable, QueryId, Queryable, QueryableByName, SqlType,
356};
357358pub use diesel_derives::MultiConnection;
359360pub mod dsl {
361//! Includes various helper types and bare functions which are named too
362 //! generically to be included in prelude, but are often used when using Diesel.
363364#[allow(hidden_glob_reexports, non_camel_case_types, dead_code)]
mod helper_types_proxy {
#[doc(inline)]
pub use crate::helper_types::*;
type abbrev = ();
type array_append = ();
type array_cat = ();
type array_dims = ();
type array_fill_with_lower_bound = ();
type array_fill = ();
type array_length = ();
type array_lower = ();
type array_ndims = ();
type array_position_with_subscript = ();
type array_position = ();
type array_positions = ();
type array_prepend = ();
type array_remove = ();
type array_replace = ();
type array_sample = ();
type array_shuffle = ();
type array_to_json = ();
type array_to_string_with_null_string = ();
type array_to_string = ();
type array_upper = ();
type avg = ();
type broadcast = ();
type cardinality = ();
type daterange = ();
type family = ();
type first_value = ();
type host = ();
type hostmask = ();
type inet_merge = ();
type inet_same_family = ();
type int4range = ();
type int8range = ();
type isempty = ();
type json_array_length = ();
type json_build_array_0 = ();
type json_build_array_1 = ();
type json_build_array_2 = ();
type json_extract_path_1 = ();
type json_extract_path_2 = ();
type json_extract_path_text_1 = ();
type json_extract_path_text_2 = ();
type json_object_with_keys_and_values = ();
type json_object = ();
type json_populate_record = ();
type json_strip_nulls = ();
type json_typeof = ();
type jsonb_array_length = ();
type jsonb_build_array_0 = ();
type jsonb_build_array_1 = ();
type jsonb_build_array_2 = ();
type jsonb_extract_path_1 = ();
type jsonb_extract_path_2 = ();
type jsonb_extract_path_text_1 = ();
type jsonb_extract_path_text_2 = ();
type jsonb_insert_with_insert_after = ();
type jsonb_insert = ();
type jsonb_object_with_keys_and_values = ();
type jsonb_object = ();
type jsonb_populate_record = ();
type jsonb_pretty = ();
type jsonb_set_create_if_missing = ();
type jsonb_set_lax = ();
type jsonb_set = ();
type jsonb_strip_nulls = ();
type jsonb_typeof = ();
type lag_with_offset_and_default = ();
type lag_with_offset = ();
type lag = ();
type last_value = ();
type lead_with_offset_and_default = ();
type lead_with_offset = ();
type lead = ();
type lower_inc = ();
type lower_inf = ();
type lower = ();
type masklen = ();
type max = ();
type min = ();
type multirange_merge = ();
type netmask = ();
type network = ();
type nth_value = ();
type numrange = ();
type range_merge = ();
type row_to_json = ();
type set_masklen = ();
type sum = ();
type to_json = ();
type to_jsonb = ();
type trim_array = ();
type tsrange = ();
type tstzrange = ();
type upper_inc = ();
type upper_inf = ();
type upper = ();
type json = ();
type json_array_0 = ();
type json_array_1 = ();
type json_array_2 = ();
type json_array_length_with_path = ();
type json_error_position = ();
type json_extract_double = ();
type json_extract_integer = ();
type json_extract_json_1 = ();
type json_extract_json_2 = ();
type json_extract_string = ();
type json_group_array = ();
type json_group_object = ();
type json_insert_0 = ();
type json_insert_1 = ();
type json_insert_2 = ();
type json_object_0 = ();
type json_object_1 = ();
type json_object_2 = ();
type json_patch = ();
type json_pretty = ();
type json_pretty_with_indentation = ();
type json_quote = ();
type json_remove_0 = ();
type json_remove_1 = ();
type json_remove_2 = ();
type json_replace_0 = ();
type json_replace_1 = ();
type json_replace_2 = ();
type json_set_0 = ();
type json_set_1 = ();
type json_set_2 = ();
type json_type = ();
type json_type_with_path = ();
type json_valid = ();
type json_valid_with_flags = ();
type jsonb = ();
type jsonb_array_0 = ();
type jsonb_array_1 = ();
type jsonb_array_2 = ();
type jsonb_extract_double = ();
type jsonb_extract_integer = ();
type jsonb_extract_jsonb_1 = ();
type jsonb_extract_jsonb_2 = ();
type jsonb_extract_string = ();
type jsonb_group_array = ();
type jsonb_group_object = ();
type jsonb_insert_0 = ();
type jsonb_insert_1 = ();
type jsonb_insert_2 = ();
type jsonb_object_0 = ();
type jsonb_object_1 = ();
type jsonb_object_2 = ();
type jsonb_patch = ();
type jsonb_remove_0 = ();
type jsonb_remove_1 = ();
type jsonb_remove_2 = ();
type jsonb_replace_0 = ();
type jsonb_replace_1 = ();
type jsonb_replace_2 = ();
type jsonb_set_0 = ();
type jsonb_set_1 = ();
type jsonb_set_2 = ();
}make_proxy_mod!(helper_types_proxy, crate::helper_types);
365#[doc(inline)]
366pub use helper_types_proxy::*;
367368#[allow(hidden_glob_reexports, non_camel_case_types, dead_code)]
mod expression_dsl_proxy {
#[doc(inline)]
pub use crate::expression::dsl::*;
type abbrev = ();
type array_append = ();
type array_cat = ();
type array_dims = ();
type array_fill_with_lower_bound = ();
type array_fill = ();
type array_length = ();
type array_lower = ();
type array_ndims = ();
type array_position_with_subscript = ();
type array_position = ();
type array_positions = ();
type array_prepend = ();
type array_remove = ();
type array_replace = ();
type array_sample = ();
type array_shuffle = ();
type array_to_json = ();
type array_to_string_with_null_string = ();
type array_to_string = ();
type array_upper = ();
type avg = ();
type broadcast = ();
type cardinality = ();
type daterange = ();
type family = ();
type first_value = ();
type host = ();
type hostmask = ();
type inet_merge = ();
type inet_same_family = ();
type int4range = ();
type int8range = ();
type isempty = ();
type json_array_length = ();
type json_build_array_0 = ();
type json_build_array_1 = ();
type json_build_array_2 = ();
type json_extract_path_1 = ();
type json_extract_path_2 = ();
type json_extract_path_text_1 = ();
type json_extract_path_text_2 = ();
type json_object_with_keys_and_values = ();
type json_object = ();
type json_populate_record = ();
type json_strip_nulls = ();
type json_typeof = ();
type jsonb_array_length = ();
type jsonb_build_array_0 = ();
type jsonb_build_array_1 = ();
type jsonb_build_array_2 = ();
type jsonb_extract_path_1 = ();
type jsonb_extract_path_2 = ();
type jsonb_extract_path_text_1 = ();
type jsonb_extract_path_text_2 = ();
type jsonb_insert_with_insert_after = ();
type jsonb_insert = ();
type jsonb_object_with_keys_and_values = ();
type jsonb_object = ();
type jsonb_populate_record = ();
type jsonb_pretty = ();
type jsonb_set_create_if_missing = ();
type jsonb_set_lax = ();
type jsonb_set = ();
type jsonb_strip_nulls = ();
type jsonb_typeof = ();
type lag_with_offset_and_default = ();
type lag_with_offset = ();
type lag = ();
type last_value = ();
type lead_with_offset_and_default = ();
type lead_with_offset = ();
type lead = ();
type lower_inc = ();
type lower_inf = ();
type lower = ();
type masklen = ();
type max = ();
type min = ();
type multirange_merge = ();
type netmask = ();
type network = ();
type nth_value = ();
type numrange = ();
type range_merge = ();
type row_to_json = ();
type set_masklen = ();
type sum = ();
type to_json = ();
type to_jsonb = ();
type trim_array = ();
type tsrange = ();
type tstzrange = ();
type upper_inc = ();
type upper_inf = ();
type upper = ();
type json = ();
type json_array_0 = ();
type json_array_1 = ();
type json_array_2 = ();
type json_array_length_with_path = ();
type json_error_position = ();
type json_extract_double = ();
type json_extract_integer = ();
type json_extract_json_1 = ();
type json_extract_json_2 = ();
type json_extract_string = ();
type json_group_array = ();
type json_group_object = ();
type json_insert_0 = ();
type json_insert_1 = ();
type json_insert_2 = ();
type json_object_0 = ();
type json_object_1 = ();
type json_object_2 = ();
type json_patch = ();
type json_pretty = ();
type json_pretty_with_indentation = ();
type json_quote = ();
type json_remove_0 = ();
type json_remove_1 = ();
type json_remove_2 = ();
type json_replace_0 = ();
type json_replace_1 = ();
type json_replace_2 = ();
type json_set_0 = ();
type json_set_1 = ();
type json_set_2 = ();
type json_type = ();
type json_type_with_path = ();
type json_valid = ();
type json_valid_with_flags = ();
type jsonb = ();
type jsonb_array_0 = ();
type jsonb_array_1 = ();
type jsonb_array_2 = ();
type jsonb_extract_double = ();
type jsonb_extract_integer = ();
type jsonb_extract_jsonb_1 = ();
type jsonb_extract_jsonb_2 = ();
type jsonb_extract_string = ();
type jsonb_group_array = ();
type jsonb_group_object = ();
type jsonb_insert_0 = ();
type jsonb_insert_1 = ();
type jsonb_insert_2 = ();
type jsonb_object_0 = ();
type jsonb_object_1 = ();
type jsonb_object_2 = ();
type jsonb_patch = ();
type jsonb_remove_0 = ();
type jsonb_remove_1 = ();
type jsonb_remove_2 = ();
type jsonb_replace_0 = ();
type jsonb_replace_1 = ();
type jsonb_replace_2 = ();
type jsonb_set_0 = ();
type jsonb_set_1 = ();
type jsonb_set_2 = ();
}make_proxy_mod!(expression_dsl_proxy, crate::expression::dsl);
369#[doc(inline)]
370pub use expression_dsl_proxy::*;
371372#[doc(inline)]
373pub use crate::query_builder::functions::{
374delete, insert_into, insert_or_ignore_into, replace_into, select, sql_query, update,
375 };
376377#[doc(inline)]
378 #[cfg(feature = "postgres_backend")]
379pub use crate::query_builder::functions::{copy_from, copy_to};
380381#[doc(inline)]
382pub use diesel_derives::auto_type;
383384#[cfg(feature = "postgres_backend")]
385 #[doc(inline)]
386pub use crate::pg::expression::extensions::OnlyDsl;
387388#[cfg(feature = "postgres_backend")]
389 #[doc(inline)]
390pub use crate::pg::expression::extensions::TablesampleDsl;
391}
392393pub mod helper_types {
394//! Provide helper types for concisely writing the return type of functions.
395 //! As with iterators, it is unfortunately difficult to return a partially
396 //! constructed query without exposing the exact implementation of the
397 //! function. Without higher kinded types, these various DSLs can't be
398 //! combined into a single trait for boxing purposes.
399 //!
400 //! All types here are in the form `<FirstType as
401 //! DslName<OtherTypes>>::Output`. So the return type of
402 //! `users.filter(first_name.eq("John")).order(last_name.asc()).limit(10)` would
403 //! be `Limit<Order<FindBy<users, first_name, &str>, Asc<last_name>>>`
404use super::query_builder::combination_clause::{self, CombinationClause};
405use super::query_builder::{AsQuery, locking_clauseas lock};
406use super::query_dsl::methods::*;
407use super::query_dsl::*;
408use super::query_source::{aliasing, joins};
409use crate::dsl::CountStar;
410use crate::query_builder::select_clause::SelectClause;
411412#[doc(inline)]
413pub use crate::expression::helper_types::*;
414415/// Represents the return type of [`.select(selection)`](crate::prelude::QueryDsl::select)
416pub type Select<Source, Selection> = <Source as SelectDsl<Selection>>::Output;
417418/// Represents the return type of [`diesel::select(selection)`](crate::select)
419#[allow(non_camel_case_types)] // required for `#[auto_type]`
420pub type select<Selection> = crate::query_builder::SelectStatement<
421crate::query_builder::NoFromClause,
422SelectClause<Selection>,
423 >;
424425#[doc(hidden)]
426 #[deprecated(note = "Use `select` instead")]
427pub type BareSelect<Selection> = crate::query_builder::SelectStatement<
428crate::query_builder::NoFromClause,
429SelectClause<Selection>,
430 >;
431432/// Represents the return type of [`.filter(predicate)`](crate::prelude::QueryDsl::filter)
433pub type Filter<Source, Predicate> = <Source as FilterDsl<Predicate>>::Output;
434435/// Represents the return type of [`.filter(lhs.eq(rhs))`](crate::prelude::QueryDsl::filter)
436pub type FindBy<Source, Column, Value> = Filter<Source, Eq<Column, Value>>;
437438/// Represents the return type of [`.for_update()`](crate::prelude::QueryDsl::for_update)
439pub type ForUpdate<Source> = <Source as LockingDsl<lock::ForUpdate>>::Output;
440441/// Represents the return type of [`.for_no_key_update()`](crate::prelude::QueryDsl::for_no_key_update)
442pub type ForNoKeyUpdate<Source> = <Source as LockingDsl<lock::ForNoKeyUpdate>>::Output;
443444/// Represents the return type of [`.for_share()`](crate::prelude::QueryDsl::for_share)
445pub type ForShare<Source> = <Source as LockingDsl<lock::ForShare>>::Output;
446447/// Represents the return type of [`.for_key_share()`](crate::prelude::QueryDsl::for_key_share)
448pub type ForKeyShare<Source> = <Source as LockingDsl<lock::ForKeyShare>>::Output;
449450/// Represents the return type of [`.skip_locked()`](crate::prelude::QueryDsl::skip_locked)
451pub type SkipLocked<Source> = <Source as ModifyLockDsl<lock::SkipLocked>>::Output;
452453/// Represents the return type of [`.no_wait()`](crate::prelude::QueryDsl::no_wait)
454pub type NoWait<Source> = <Source as ModifyLockDsl<lock::NoWait>>::Output;
455456/// Represents the return type of [`.find(pk)`](crate::prelude::QueryDsl::find)
457pub type Find<Source, PK> = <Source as FindDsl<PK>>::Output;
458459/// Represents the return type of [`.or_filter(predicate)`](crate::prelude::QueryDsl::or_filter)
460pub type OrFilter<Source, Predicate> = <Source as OrFilterDsl<Predicate>>::Output;
461462/// Represents the return type of [`.order(ordering)`](crate::prelude::QueryDsl::order)
463pub type Order<Source, Ordering> = <Source as OrderDsl<Ordering>>::Output;
464465/// Represents the return type of [`.order_by(ordering)`](crate::prelude::QueryDsl::order_by)
466 ///
467 /// Type alias of [Order]
468pub type OrderBy<Source, Ordering> = Order<Source, Ordering>;
469470/// Represents the return type of [`.then_order_by(ordering)`](crate::prelude::QueryDsl::then_order_by)
471pub type ThenOrderBy<Source, Ordering> = <Source as ThenOrderDsl<Ordering>>::Output;
472473/// Represents the return type of [`.limit()`](crate::prelude::QueryDsl::limit)
474pub type Limit<Source, DummyArgForAutoType = i64> =
475 <Source as LimitDsl<DummyArgForAutoType>>::Output;
476477/// Represents the return type of [`.offset()`](crate::prelude::QueryDsl::offset)
478pub type Offset<Source, DummyArgForAutoType = i64> =
479 <Source as OffsetDsl<DummyArgForAutoType>>::Output;
480481/// Represents the return type of [`.inner_join(rhs)`](crate::prelude::QueryDsl::inner_join)
482pub type InnerJoin<Source, Rhs> =
483 <Source as JoinWithImplicitOnClause<Rhs, joins::Inner>>::Output;
484485/// Represents the return type of [`.inner_join(rhs.on(on))`](crate::prelude::QueryDsl::inner_join)
486pub type InnerJoinOn<Source, Rhs, On> =
487 <Source as InternalJoinDsl<Rhs, joins::Inner, On>>::Output;
488489/// Represents the return type of [`.left_join(rhs)`](crate::prelude::QueryDsl::left_join)
490pub type LeftJoin<Source, Rhs> =
491 <Source as JoinWithImplicitOnClause<Rhs, joins::LeftOuter>>::Output;
492493/// Represents the return type of [`.left_join(rhs.on(on))`](crate::prelude::QueryDsl::left_join)
494pub type LeftJoinOn<Source, Rhs, On> =
495 <Source as InternalJoinDsl<Rhs, joins::LeftOuter, On>>::Output;
496497/// Represents the return type of [`rhs.on(on)`](crate::query_dsl::JoinOnDsl::on)
498pub type On<Source, On> = joins::OnClauseWrapper<Source, On>;
499500use super::associations::HasTable;
501use super::query_builder::{AsChangeset, IntoUpdateTarget, UpdateStatement};
502503/// Represents the return type of [`update(lhs).set(rhs)`](crate::query_builder::UpdateStatement::set)
504pub type Update<Target, Changes> = UpdateStatement<
505 <Target as HasTable>::Table,
506 <Target as IntoUpdateTarget>::WhereClause,
507 <Changes as AsChangeset>::Changeset,
508 >;
509510/// Represents the return type of [`.into_boxed::<'a, DB>()`](crate::prelude::QueryDsl::into_boxed)
511pub type IntoBoxed<'a, Source, DB> = <Source as BoxedDsl<'a, DB>>::Output;
512513/// Represents the return type of [`.distinct()`](crate::prelude::QueryDsl::distinct)
514pub type Distinct<Source> = <Source as DistinctDsl>::Output;
515516/// Represents the return type of [`.distinct_on(expr)`](crate::prelude::QueryDsl::distinct_on)
517#[cfg(feature = "postgres_backend")]
518pub type DistinctOn<Source, Expr> = <Source as DistinctOnDsl<Expr>>::Output;
519520/// Represents the return type of [`.single_value()`](SingleValueDsl::single_value)
521pub type SingleValue<Source> = <Source as SingleValueDsl>::Output;
522523/// Represents the return type of [`.nullable()`](SelectNullableDsl::nullable)
524pub type NullableSelect<Source> = <Source as SelectNullableDsl>::Output;
525526/// Represents the return type of [`.group_by(expr)`](crate::prelude::QueryDsl::group_by)
527pub type GroupBy<Source, Expr> = <Source as GroupByDsl<Expr>>::Output;
528529/// Represents the return type of [`.having(predicate)`](crate::prelude::QueryDsl::having)
530pub type Having<Source, Predicate> = <Source as HavingDsl<Predicate>>::Output;
531532/// Represents the return type of [`.union(rhs)`](crate::prelude::CombineDsl::union)
533pub type Union<Source, Rhs> = CombinationClause<
534 combination_clause::Union,
535 combination_clause::Distinct,
536 <Source as CombineDsl>::Query,
537 <Rhs as AsQuery>::Query,
538 >;
539540/// Represents the return type of [`.union_all(rhs)`](crate::prelude::CombineDsl::union_all)
541pub type UnionAll<Source, Rhs> = CombinationClause<
542 combination_clause::Union,
543 combination_clause::All,
544 <Source as CombineDsl>::Query,
545 <Rhs as AsQuery>::Query,
546 >;
547548/// Represents the return type of [`.intersect(rhs)`](crate::prelude::CombineDsl::intersect)
549pub type Intersect<Source, Rhs> = CombinationClause<
550 combination_clause::Intersect,
551 combination_clause::Distinct,
552 <Source as CombineDsl>::Query,
553 <Rhs as AsQuery>::Query,
554 >;
555556/// Represents the return type of [`.intersect_all(rhs)`](crate::prelude::CombineDsl::intersect_all)
557pub type IntersectAll<Source, Rhs> = CombinationClause<
558 combination_clause::Intersect,
559 combination_clause::All,
560 <Source as CombineDsl>::Query,
561 <Rhs as AsQuery>::Query,
562 >;
563564/// Represents the return type of [`.except(rhs)`](crate::prelude::CombineDsl::except)
565pub type Except<Source, Rhs> = CombinationClause<
566 combination_clause::Except,
567 combination_clause::Distinct,
568 <Source as CombineDsl>::Query,
569 <Rhs as AsQuery>::Query,
570 >;
571572/// Represents the return type of [`.except_all(rhs)`](crate::prelude::CombineDsl::except_all)
573pub type ExceptAll<Source, Rhs> = CombinationClause<
574 combination_clause::Except,
575 combination_clause::All,
576 <Source as CombineDsl>::Query,
577 <Rhs as AsQuery>::Query,
578 >;
579580type JoinQuerySource<Left, Right, Kind, On> = joins::JoinOn<joins::Join<Left, Right, Kind>, On>;
581582/// A query source representing the inner join between two tables.
583 ///
584 /// The third generic type (`On`) controls how the tables are
585 /// joined.
586 ///
587 /// By default, the implicit join established by [`joinable!`][]
588 /// will be used, allowing you to omit the exact join
589 /// condition. For example, for the inner join between three
590 /// tables that implement [`JoinTo`][], you only need to specify
591 /// the tables: `InnerJoinQuerySource<InnerJoinQuerySource<table1,
592 /// table2>, table3>`.
593 ///
594 /// [`JoinTo`]: crate::query_source::JoinTo
595 ///
596 /// If you use an explicit `ON` clause, you will need to specify
597 /// the `On` generic type.
598 ///
599 /// ```rust
600 /// # include!("doctest_setup.rs");
601 /// use diesel::{dsl, helper_types::InnerJoinQuerySource};
602 /// # use diesel::{backend::Backend, serialize::ToSql, sql_types};
603 /// use schema::*;
604 ///
605 /// # fn main() -> QueryResult<()> {
606 /// # let conn = &mut establish_connection();
607 /// #
608 /// // If you have an explicit join like this...
609 /// let join_constraint = comments::columns::post_id.eq(posts::columns::id);
610 /// # let query =
611 /// posts::table.inner_join(comments::table.on(join_constraint));
612 /// #
613 /// # // Dummy usage just to ensure the example compiles.
614 /// # let filter = posts::columns::id.eq(1);
615 /// # let filter: &FilterExpression<_> = &filter;
616 /// # query.filter(filter).select(posts::columns::id).get_result::<i32>(conn)?;
617 /// #
618 /// # Ok(())
619 /// # }
620 ///
621 /// // ... you can use `InnerJoinQuerySource` like this.
622 /// type JoinConstraint = dsl::Eq<comments::columns::post_id, posts::columns::id>;
623 /// type MyInnerJoinQuerySource = InnerJoinQuerySource<posts::table, comments::table, JoinConstraint>;
624 /// # type FilterExpression<DB> = dyn BoxableExpression<MyInnerJoinQuerySource, DB, SqlType = sql_types::Bool>;
625 /// ```
626pub type InnerJoinQuerySource<Left, Right, On = <Left as joins::JoinTo<Right>>::OnClause> =
627JoinQuerySource<Left, Right, joins::Inner, On>;
628629/// A query source representing the left outer join between two tables.
630 ///
631 /// The third generic type (`On`) controls how the tables are
632 /// joined.
633 ///
634 /// By default, the implicit join established by [`joinable!`][]
635 /// will be used, allowing you to omit the exact join
636 /// condition. For example, for the left join between three
637 /// tables that implement [`JoinTo`][], you only need to specify
638 /// the tables: `LeftJoinQuerySource<LeftJoinQuerySource<table1,
639 /// table2>, table3>`.
640 ///
641 /// [`JoinTo`]: crate::query_source::JoinTo
642 ///
643 /// If you use an explicit `ON` clause, you will need to specify
644 /// the `On` generic type.
645 ///
646 /// ```rust
647 /// # include!("doctest_setup.rs");
648 /// use diesel::{dsl, helper_types::LeftJoinQuerySource};
649 /// # use diesel::{backend::Backend, serialize::ToSql, sql_types};
650 /// use schema::*;
651 ///
652 /// # fn main() -> QueryResult<()> {
653 /// # let conn = &mut establish_connection();
654 /// #
655 /// // If you have an explicit join like this...
656 /// let join_constraint = comments::columns::post_id.eq(posts::columns::id);
657 /// # let query =
658 /// posts::table.left_join(comments::table.on(join_constraint));
659 /// #
660 /// # // Dummy usage just to ensure the example compiles.
661 /// # let filter = posts::columns::id.eq(1);
662 /// # let filter: &FilterExpression<_> = &filter;
663 /// # query.filter(filter).select(posts::columns::id).get_result::<i32>(conn)?;
664 /// #
665 /// # Ok(())
666 /// # }
667 ///
668 /// // ... you can use `LeftJoinQuerySource` like this.
669 /// type JoinConstraint = dsl::Eq<comments::columns::post_id, posts::columns::id>;
670 /// type MyLeftJoinQuerySource = LeftJoinQuerySource<posts::table, comments::table, JoinConstraint>;
671 /// # type FilterExpression<DB> = dyn BoxableExpression<MyLeftJoinQuerySource, DB, SqlType = sql_types::Bool>;
672 /// ```
673pub type LeftJoinQuerySource<Left, Right, On = <Left as joins::JoinTo<Right>>::OnClause> =
674JoinQuerySource<Left, Right, joins::LeftOuter, On>;
675676/// Maps `F` to `Alias<S>`
677 ///
678 /// Any column `F` that belongs to `S::Table` will be transformed into
679 /// [`AliasedField<S, Self>`](crate::query_source::AliasedField)
680 ///
681 /// Any column `F` that does not belong to `S::Table` will be left untouched.
682 ///
683 /// This also works with tuples and some expressions.
684pub type AliasedFields<S, F> = <F as aliasing::FieldAliasMapper<S>>::Out;
685686#[doc(hidden)]
687 #[cfg(all(feature = "with-deprecated", not(feature = "without-deprecated")))]
688 #[deprecated(note = "Use `LoadQuery::RowIter` directly")]
689pub type LoadIter<'conn, 'query, Q, Conn, U, B = crate::connection::DefaultLoadingMode> =
690 <Q as load_dsl::LoadQuery<'query, Conn, U, B>>::RowIter<'conn>;
691692/// Represents the return type of [`diesel::delete`]
693#[allow(non_camel_case_types)] // required for `#[auto_type]`
694pub type delete<T> = crate::query_builder::DeleteStatement<
695 <T as HasTable>::Table,
696 <T as IntoUpdateTarget>::WhereClause,
697 >;
698699/// Represents the return type of [`diesel::insert_into`]
700#[allow(non_camel_case_types)] // required for `#[auto_type]`
701pub type insert_into<T> = crate::query_builder::IncompleteInsertStatement<T>;
702703/// Represents the return type of [`diesel::update`]
704#[allow(non_camel_case_types)] // required for `#[auto_type]`
705pub type update<T> =
706UpdateStatement<<T as HasTable>::Table, <T as IntoUpdateTarget>::WhereClause>;
707708/// Represents the return type of [`diesel::insert_or_ignore_into`]
709#[allow(non_camel_case_types)] // required for `#[auto_type]`
710pub type insert_or_ignore_into<T> = crate::query_builder::IncompleteInsertOrIgnoreStatement<T>;
711712/// Represents the return type of [`diesel::replace_into`]
713#[allow(non_camel_case_types)] // required for `#[auto_type]`
714pub type replace_into<T> = crate::query_builder::IncompleteReplaceStatement<T>;
715716/// Represents the return type of
717 /// [`IncompleteInsertStatement::values()`](crate::query_builder::IncompleteInsertStatement::values)
718pub type Values<I, U> = crate::query_builder::InsertStatement<
719 <I as crate::query_builder::insert_statement::InsertAutoTypeHelper>::Table,
720 <U as crate::Insertable<
721 <I as crate::query_builder::insert_statement::InsertAutoTypeHelper>::Table,
722 >>::Values,
723 <I as crate::query_builder::insert_statement::InsertAutoTypeHelper>::Op,
724 >;
725726/// Represents the return type of
727 /// [`InsertStatement::on_conflict()`](crate::query_builder::InsertStatement::on_conflict)
728pub type OnConflict<I, Target> = crate::upsert::IncompleteOnConflict<
729crate::query_builder::InsertStatement<
730 <I as crate::query_builder::insert_statement::InsertAutoTypeHelper>::Table,
731 <<I as crate::query_builder::insert_statement::InsertAutoTypeHelper>::Valuesas crate::query_builder::IntoConflictValueClause>::ValueClause,
732 <I as crate::query_builder::insert_statement::InsertAutoTypeHelper>::Op,
733 <I as crate::query_builder::insert_statement::InsertAutoTypeHelper>::Ret,
734 >,
735crate::query_builder::ConflictTarget<Target>,
736 >;
737738/// Represents the return type of [`InsertStatement::on_conflict_do_nothing`](crate::query_builder::InsertStatement::on_conflict_do_nothing)
739pub type OnConflictDoNothing<I> = crate::query_builder::InsertStatement<
740 <I as crate::query_builder::insert_statement::InsertAutoTypeHelper>::Table,
741crate::query_builder::upsert::on_conflict_clause::OnConflictValues<
742 <<I as crate::query_builder::insert_statement::InsertAutoTypeHelper>::Valuesas crate::query_builder::IntoConflictValueClause>::ValueClause,
743crate::query_builder::upsert::on_conflict_target::NoConflictTarget,
744crate::query_builder::upsert::on_conflict_actions::DoNothing<
745 <I as crate::query_builder::insert_statement::InsertAutoTypeHelper>::Table,
746 >,
747 >,
748 <I as crate::query_builder::insert_statement::InsertAutoTypeHelper>::Op,
749 <I as crate::query_builder::insert_statement::InsertAutoTypeHelper>::Ret,
750 >;
751752/// Represents the return type of
753 /// [`IncompleteOnConflict::do_nothing()`](crate::upsert::IncompleteOnConflict::do_nothing)
754pub type DoNothing<I> = crate::query_builder::InsertStatement<
755 <I as crate::upsert::OnConflictHelper>::Table,
756crate::query_builder::upsert::on_conflict_clause::OnConflictValues<
757 <I as crate::upsert::OnConflictHelper>::Values,
758 <I as crate::upsert::OnConflictHelper>::Target,
759crate::query_builder::upsert::on_conflict_actions::DoNothing<
760 <I as crate::upsert::OnConflictHelper>::Table,
761 >,
762 >,
763 <I as crate::upsert::OnConflictHelper>::Op,
764 <I as crate::upsert::OnConflictHelper>::Ret,
765 >;
766767/// Represents the return type of
768 /// [`IncompleteOnConflict::do_update()`](crate::upsert::IncompleteOnConflict::do_update)
769pub type DoUpdate<I> = crate::upsert::IncompleteDoUpdate<
770crate::query_builder::InsertStatement<
771 <I as crate::upsert::OnConflictHelper>::Table,
772 <I as crate::upsert::OnConflictHelper>::Values,
773 <I as crate::upsert::OnConflictHelper>::Op,
774 <I as crate::upsert::OnConflictHelper>::Ret,
775 >,
776 <I as crate::upsert::OnConflictHelper>::Target,
777 >;
778779/// Represents the return type of
780 /// [`UpdateStatement::set()`](crate::query_builder::UpdateStatement::set) and
781 /// [`IncompleteDoUpdate::set()`](crate::upsert::IncompleteDoUpdate::set)
782pub type Set<U, V> = <U as crate::query_builder::update_statement::SetAutoTypeHelper<V>>::Out;
783784/// Represents the return type of
785 /// [`InsertStatement::returning`](crate::query_builder::InsertStatement::returning),
786 /// [`UpdateStatement::returning`] and
787 /// [`DeleteStatement::returning`](crate::query_builder::DeleteStatement::returning)
788pub type Returning<Q, S> =
789 <Q as crate::query_builder::returning::ReturningClauseHelper<S>>::WithReturning;
790791#[doc(hidden)] // used for `QueryDsl::count`
792pub type Count<Q> = Select<Q, CountStar>;
793}
794795pub mod prelude {
796797//! Re-exports important traits and types. Meant to be glob imported when using Diesel.
798799#[doc(inline)]
800pub use crate::associations::{Associations, GroupedBy, Identifiable};
801#[doc(inline)]
802pub use crate::connection::Connection;
803#[doc(inline)]
804pub use crate::deserialize::{Queryable, QueryableByName};
805#[doc(inline)]
806pub use crate::expression::{
807AppearsOnTable, BoxableExpression, Expression, IntoSql, Selectable, SelectableExpression,
808 };
809// If [`IntoSql`](crate::expression::helper_types::IntoSql) the type gets imported at the
810 // same time as IntoSql the trait (this one) gets imported via the prelude, then
811 // methods of the trait won't be resolved because the type may take priority over the trait.
812 // That issue can be avoided by also importing it anonymously:
813pub use crate::expression::IntoSqlas _;
814815#[doc(inline)]
816pub use crate::expression::functions::declare_sql_function;
817#[doc(inline)]
818pub use crate::expression::functions::define_sql_function;
819#[cfg(all(feature = "with-deprecated", not(feature = "without-deprecated")))]
820pub use crate::expression::functions::sql_function;
821822#[doc(inline)]
823pub use crate::expression::SelectableHelper;
824#[doc(inline)]
825pub use crate::expression_methods::*;
826#[doc(inline)]
827pub use crate::insertable::Insertable;
828#[doc(inline)]
829pub use crate::macros::prelude::*;
830#[doc(inline)]
831pub use crate::query_builder::AsChangeset;
832#[doc(inline)]
833pub use crate::query_builder::DecoratableTarget;
834#[doc(inline)]
835pub use crate::query_builder::has_query::HasQuery;
836#[doc(inline)]
837pub use crate::query_dsl::{
838BelongingToDsl, CombineDsl, JoinOnDsl, QueryDsl, RunQueryDsl, SaveChangesDsl,
839 };
840pub use crate::query_source::SizeRestrictedColumnas _;
841#[doc(inline)]
842pub use crate::query_source::{Column, JoinTo, QuerySource, Table};
843#[doc(inline)]
844pub use crate::result::{
845ConnectionError, ConnectionResult, OptionalEmptyChangesetExtension, OptionalExtension,
846QueryResult,
847 };
848#[doc(inline)]
849pub use diesel_derives::allow_tables_to_appear_in_same_query;
850#[doc(inline)]
851pub use diesel_derives::table_procas table;
852#[doc(inline)]
853pub use diesel_derives::view_procas view;
854855#[cfg(feature = "mysql")]
856 #[doc(inline)]
857pub use crate::mysql::MysqlConnection;
858#[cfg(feature = "postgres")]
859 #[doc(inline)]
860pub use crate::pg::PgConnection;
861#[doc(inline)]
862 #[cfg(feature = "postgres_backend")]
863pub use crate::pg::query_builder::copy::ExecuteCopyFromDsl;
864#[cfg(feature = "__sqlite-shared")]
865 #[doc(inline)]
866pub use crate::sqlite::SqliteConnection;
867}
868869#[doc(inline)]
870pub use crate::macros::table;
871872#[doc(inline)]
873pub use diesel_derives::allow_tables_to_appear_in_same_query;
874875pub use crate::prelude::*;
876#[doc(inline)]
877pub use crate::query_builder::debug_query;
878#[doc(inline)]
879#[cfg(feature = "postgres")]
880pub use crate::query_builder::functions::{copy_from, copy_to};
881#[doc(inline)]
882pub use crate::query_builder::functions::{
883delete, insert_into, insert_or_ignore_into, replace_into, select, sql_query, update,
884};
885pub use crate::result::Error::NotFound;
886887extern crate self as diesel;