from_pg/lib.rs
1pub use from_pg_derive::FromPg;
2pub use tokio_postgres::Row;
3
4pub trait FromPg: Sized {
5 type Config: Default;
6 type Error: Into<Box<dyn std::error::Error + Send + Sync>>;
7
8 fn from_pg(row: &Row, conf: &Self::Config) -> Result<Self, Self::Error>;
9
10 fn from_pg_default(row: &Row) -> Result<Self, Self::Error> {
11 Self::from_pg(row, &Self::Config::default())
12 }
13}
14
15// #[cfg(test)]
16// mod tests {
17// use super::*;
18
19// #[test]
20// fn it_works() {
21// let result = add(2, 2);
22// assert_eq!(result, 4);
23// }
24// }