Skip to main content

diesel/pg/
mod.rs

1//! Provides types and functions related to working with PostgreSQL
2//!
3//! Much of this module is re-exported from database agnostic locations.
4//! However, if you are writing code specifically to extend Diesel on
5//! PostgreSQL, you may need to work with this module directly.
6
7pub mod expression;
8mod types;
9
10pub(crate) mod backend;
11#[cfg(feature = "postgres")]
12pub(crate) mod connection;
13mod metadata_lookup;
14pub(crate) mod query_builder;
15pub mod returning;
16pub(crate) mod serialize;
17mod transaction;
18mod value;
19
20#[doc(inline)]
21pub use self::backend::{Pg, PgNotification, PgTypeMetadata};
22#[cfg(feature = "postgres")]
23pub use self::connection::{PgConnection, PgRowByRowLoadingMode};
24#[doc(inline)]
25pub use self::metadata_lookup::PgMetadataLookup;
26#[doc(inline)]
27pub use self::query_builder::DistinctOnClause;
28#[doc(inline)]
29pub use self::query_builder::OrderDecorator;
30#[doc(inline)]
31pub use self::query_builder::PgQueryBuilder;
32#[doc(inline)]
33pub use self::query_builder::{CopyFormat, CopyFromQuery, CopyHeader, CopyTarget, CopyToQuery};
34#[doc(inline)]
35pub use self::transaction::TransactionBuilder;
36#[doc(inline)]
37pub use self::value::PgValue;
38#[doc(inline)]
39pub use sqlstate::pg as sql_state;
40
41#[doc(inline)]
42#[cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes")]
43pub use self::backend::FailedToLookupTypeError;
44#[doc(inline)]
45#[cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes")]
46pub use self::metadata_lookup::{GetPgMetadataCache, PgMetadataCache, PgMetadataCacheKey};
47#[doc(inline)]
48#[cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes")]
49pub use self::value::TypeOidLookup;
50
51#[doc(hidden)]
52#[cfg(all(feature = "with-deprecated", not(feature = "without-deprecated")))]
53#[deprecated(since = "2.0.0", note = "Use `diesel::upsert` instead")]
54pub use crate::upsert;
55
56/// Data structures for PG types which have no corresponding Rust type
57///
58/// Most of these types are used to implement `ToSql` and `FromSql` for higher
59/// level types.
60pub mod data_types {
61    #[doc(inline)]
62    pub use super::types::array::NdArray;
63    #[doc(inline)]
64    pub use super::types::date_and_time::{PgDate, PgInterval, PgTime, PgTimestamp};
65    #[doc(inline)]
66    pub use super::types::floats::PgNumeric;
67    #[doc(inline)]
68    pub use super::types::money::PgMoney;
69    pub use super::types::money::PgMoney as Cents;
70    #[doc(inline)]
71    pub use super::types::pg_lsn::PgLsn;
72}
73
74#[doc(inline)]
75pub use self::types::sql_types;