1#![allow(unexpected_cfgs)]
6
7pub mod attrs;
9pub mod builder;
10pub mod common;
11pub mod expressions;
12pub mod helpers;
13pub mod traits;
14pub mod values;
15
16pub use builder::{BuilderInit, CTEInit, ExecutableState, QueryBuilder};
18pub use common::{Join, JoinType, Number, PostgresSchemaType};
19pub use traits::{
20 DrizzleRow, FromPostgresValue, PostgresColumn, PostgresColumnInfo, PostgresEnum, PostgresTable,
21 PostgresTableInfo,
22};
23pub use values::{PostgresInsertValue, PostgresValue, ValueWrapper};
24
25#[cfg(all(feature = "postgres-sync", not(feature = "tokio-postgres")))]
27pub use postgres::Row;
28#[cfg(feature = "tokio-postgres")]
29pub use tokio_postgres::Row;
30
31pub use drizzle_core::ParamBind;
33
34pub type PostgresSQL<'a> = drizzle_core::SQL<'a, PostgresValue<'a>>;
36
37#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
39pub enum PostgresTransactionType {
40 ReadUncommitted,
42 #[default]
44 ReadCommitted,
45 RepeatableRead,
47 Serializable,
49}
50
51impl std::fmt::Display for PostgresTransactionType {
52 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
53 let level = match self {
54 PostgresTransactionType::ReadUncommitted => "READ UNCOMMITTED",
55 PostgresTransactionType::ReadCommitted => "READ COMMITTED",
56 PostgresTransactionType::RepeatableRead => "REPEATABLE READ",
57 PostgresTransactionType::Serializable => "SERIALIZABLE",
58 };
59 write!(f, "{}", level)
60 }
61}
62
63#[macro_export]
76macro_rules! params {
77 [$($param:tt),+ $(,)?] => {
78 [
79 $(
80 $crate::params_internal!($param)
81 ),+
82 ]
83 };
84}
85
86#[macro_export]
88macro_rules! params_internal {
89 ({ $key:ident: $value:expr }) => {
90 $crate::ParamBind::named(stringify!($key), $crate::PostgresValue::from($value))
91 };
92 ($value:expr) => {
93 $crate::ParamBind::positional($crate::PostgresValue::from($value))
94 };
95}