postgres_from_row/
lib.rs

1#![deny(missing_docs)]
2#![doc = include_str!("../README.md")]
3
4pub use postgres_from_row_derive::FromRow;
5pub use tokio_postgres;
6
7/// A trait that allows mapping rows from either [postgres](<https://docs.rs/postgres>) or [tokio-postgres](<https://docs.rs/tokio-postgres>), to other types.
8pub trait FromRow: Sized {
9    /// Performce the conversion
10    ///
11    /// # Panics
12    ///
13    /// panics if the row does not contain the expected column names.
14    fn from_row(row: &tokio_postgres::Row) -> Self;
15
16    /// Try's to perform the conversion.
17    ///
18    /// Will return an error if the row does not contain the expected column names.
19    fn try_from_row(row: &tokio_postgres::Row) -> Result<Self, tokio_postgres::Error>;
20}