#[cfg(all(
feature = "postgres",
not(feature = "libsql"),
not(feature = "rusqlite"),
))]
#[macro_export]
macro_rules! impl_derived_from_row {
($ty:ty, $cols:expr, postgres = |$p:ident| $pb:block,
libsql = |$l:ident| $lb:block, rusqlite = |$r:ident| $rb:block $(,)?) => {
impl $crate::row::FromRow for $ty {
const REQUIRED_COLUMNS: &'static [&'static str] = $cols;
fn from_row($p: &$crate::tokio_postgres::Row)
-> Result<Self, $crate::error::DbCoreError> $pb
}
};
}
#[cfg(all(
feature = "libsql",
not(feature = "postgres"),
not(feature = "rusqlite"),
))]
#[macro_export]
macro_rules! impl_derived_from_row {
($ty:ty, $cols:expr, postgres = |$p:ident| $pb:block,
libsql = |$l:ident| $lb:block, rusqlite = |$r:ident| $rb:block $(,)?) => {
impl $crate::row::FromRow for $ty {
const REQUIRED_COLUMNS: &'static [&'static str] = $cols;
fn from_row($l: &$crate::libsql::Row) -> Result<Self, $crate::error::DbCoreError> $lb
}
};
}
#[cfg(all(
feature = "rusqlite",
not(feature = "postgres"),
not(feature = "libsql"),
))]
#[macro_export]
macro_rules! impl_derived_from_row {
($ty:ty, $cols:expr, postgres = |$p:ident| $pb:block,
libsql = |$l:ident| $lb:block, rusqlite = |$r:ident| $rb:block $(,)?) => {
impl $crate::row::FromRow for $ty {
const REQUIRED_COLUMNS: &'static [&'static str] = $cols;
fn from_row($r: &$crate::rusqlite::Row<'_>) -> Result<Self, $crate::error::DbCoreError> $rb
}
};
}
#[cfg(all(feature = "postgres", feature = "libsql", not(feature = "rusqlite"),))]
#[macro_export]
macro_rules! impl_derived_from_row {
($ty:ty, $cols:expr, postgres = |$p:ident| $pb:block,
libsql = |$l:ident| $lb:block, rusqlite = |$r:ident| $rb:block $(,)?) => {
impl $crate::row::FromRow for $ty {
const REQUIRED_COLUMNS: &'static [&'static str] = $cols;
fn from_pg_row($p: &$crate::tokio_postgres::Row)
-> Result<Self, $crate::error::DbCoreError> $pb
fn from_libsql_row($l: &$crate::libsql::Row)
-> Result<Self, $crate::error::DbCoreError> $lb
}
};
}
#[cfg(all(feature = "postgres", feature = "rusqlite", not(feature = "libsql"),))]
#[macro_export]
macro_rules! impl_derived_from_row {
($ty:ty, $cols:expr, postgres = |$p:ident| $pb:block,
libsql = |$l:ident| $lb:block, rusqlite = |$r:ident| $rb:block $(,)?) => {
impl $crate::row::FromRow for $ty {
const REQUIRED_COLUMNS: &'static [&'static str] = $cols;
fn from_pg_row($p: &$crate::tokio_postgres::Row)
-> Result<Self, $crate::error::DbCoreError> $pb
fn from_rusqlite_row($r: &$crate::rusqlite::Row<'_>)
-> Result<Self, $crate::error::DbCoreError> $rb
}
};
}
#[cfg(all(feature = "libsql", feature = "rusqlite", not(feature = "postgres"),))]
#[macro_export]
macro_rules! impl_derived_from_row {
($ty:ty, $cols:expr, postgres = |$p:ident| $pb:block,
libsql = |$l:ident| $lb:block, rusqlite = |$r:ident| $rb:block $(,)?) => {
impl $crate::row::FromRow for $ty {
const REQUIRED_COLUMNS: &'static [&'static str] = $cols;
fn from_libsql_row($l: &$crate::libsql::Row)
-> Result<Self, $crate::error::DbCoreError> $lb
fn from_rusqlite_row($r: &$crate::rusqlite::Row<'_>)
-> Result<Self, $crate::error::DbCoreError> $rb
}
};
}
#[cfg(all(feature = "postgres", feature = "libsql", feature = "rusqlite",))]
#[macro_export]
macro_rules! impl_derived_from_row {
($ty:ty, $cols:expr, postgres = |$p:ident| $pb:block,
libsql = |$l:ident| $lb:block, rusqlite = |$r:ident| $rb:block $(,)?) => {
impl $crate::row::FromRow for $ty {
const REQUIRED_COLUMNS: &'static [&'static str] = $cols;
fn from_pg_row($p: &$crate::tokio_postgres::Row)
-> Result<Self, $crate::error::DbCoreError> $pb
fn from_libsql_row($l: &$crate::libsql::Row)
-> Result<Self, $crate::error::DbCoreError> $lb
fn from_rusqlite_row($r: &$crate::rusqlite::Row<'_>)
-> Result<Self, $crate::error::DbCoreError> $rb
}
};
}
#[cfg(not(any(
all(
feature = "postgres",
not(feature = "libsql"),
not(feature = "rusqlite")
),
all(
feature = "libsql",
not(feature = "postgres"),
not(feature = "rusqlite")
),
all(
feature = "rusqlite",
not(feature = "postgres"),
not(feature = "libsql")
),
all(feature = "postgres", feature = "libsql", not(feature = "rusqlite")),
all(feature = "postgres", feature = "rusqlite", not(feature = "libsql")),
all(feature = "libsql", feature = "rusqlite", not(feature = "postgres")),
all(feature = "postgres", feature = "libsql", feature = "rusqlite"),
)))]
#[macro_export]
macro_rules! impl_derived_from_row {
($ty:ty, $cols:expr, postgres = |$p:ident| $pb:block,
libsql = |$l:ident| $lb:block, rusqlite = |$r:ident| $rb:block $(,)?) => {
impl $crate::row::FromRow for $ty {
const REQUIRED_COLUMNS: &'static [&'static str] = $cols;
}
};
}