1pub use self::error::*;
4pub use self::index::*;
5use crate::internal::any::{AnyDecode, AnyRow, AnyType};
6use crate::row::get::try_get;
7
8mod error;
9mod get;
10mod index;
11
12pub struct Row(pub(crate) AnyRow);
14
15impl Row {
16 pub fn get<'r, 'i, T>(&'r self, index: impl Into<RowIndex<'i>>) -> Result<T, RowError<'i>>
21 where
22 T: Decode<'r>,
23 {
24 match &self.0 {
25 #[cfg(feature = "postgres")]
26 AnyRow::Postgres(row) => try_get(row, index.into()),
27 #[cfg(feature = "sqlite")]
28 AnyRow::Sqlite(row) => try_get(row, index.into()),
29 }
30 }
31}
32
33pub trait Decode<'r>: AnyType + AnyDecode<'r> {}
35impl<'r, T: AnyType + AnyDecode<'r>> Decode<'r> for T {}
36
37pub trait DecodeOwned: for<'r> Decode<'r> {}
39impl<T: for<'r> Decode<'r>> DecodeOwned for T {}