degen_sql/db/postgres/models/
model.rs

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