degen_sql/db/postgres/models/
model.rs

1use crate::db::postgres::postgres_db::DatabaseError;
2use std::mem::discriminant;
3
4use serde_json::Error as SerdeJsonError;
5use tokio_postgres::Error as PostgresError;
6
7pub trait Model {}
8
9#[derive(Debug, thiserror::Error )]
10pub enum PostgresModelError {
11    #[error("Timeout")]
12    Timeout,
13
14    #[error(transparent)]
15    Postgres(#[from] PostgresError),
16
17      
18
19
20    #[error(transparent)]
21    SerdeJson(#[from] SerdeJsonError),
22
23    #[error("Error parsing row for database: {0:?}")]
24    RowParseError(Option<String>),
25
26}
27
28impl PartialEq for PostgresModelError {
29    fn eq(&self, other: &Self) -> bool {
30        discriminant(self) == discriminant(other)
31    }
32}
33
34impl Eq for PostgresModelError {}