drizzle_postgres/
common.rs1use drizzle_core::schema::SQLEnumInfo;
2use drizzle_core::traits::SQLViewInfo;
3use drizzle_core::{SQLIndexInfo, SQLSchemaType};
4
5use crate::traits::PostgresTableInfo;
6
7#[derive(Debug, Clone)]
9pub enum PostgresSchemaType {
10 Table(&'static dyn PostgresTableInfo),
12 View(&'static dyn SQLViewInfo),
14 Index(&'static dyn SQLIndexInfo),
16 Trigger,
18 Enum(&'static dyn SQLEnumInfo),
20}
21
22impl SQLSchemaType for PostgresSchemaType {}
23
24#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
30pub enum Number {
31 Integer(i64),
33 Real(f64),
35}
36
37impl Default for Number {
38 fn default() -> Self {
39 Self::Integer(Default::default())
40 }
41}
42
43impl From<i64> for Number {
44 fn from(value: i64) -> Self {
45 Self::Integer(value)
46 }
47}
48
49impl From<f64> for Number {
50 fn from(value: f64) -> Self {
51 Self::Real(value)
52 }
53}
54
55#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
57pub enum PostgresTransactionType {
58 ReadUncommitted,
60 #[default]
62 ReadCommitted,
63 RepeatableRead,
65 Serializable,
67}
68
69impl std::fmt::Display for PostgresTransactionType {
70 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
71 let level = match self {
72 PostgresTransactionType::ReadUncommitted => "READ UNCOMMITTED",
73 PostgresTransactionType::ReadCommitted => "READ COMMITTED",
74 PostgresTransactionType::RepeatableRead => "REPEATABLE READ",
75 PostgresTransactionType::Serializable => "SERIALIZABLE",
76 };
77 write!(f, "{}", level)
78 }
79}
80
81pub use drizzle_core::{Join, JoinType};