toolu_orm_core/row/
traits.rs1#[cfg(any(feature = "postgres", feature = "libsql", feature = "rusqlite"))]
4use crate::error::DbCoreError;
5
6#[cfg(all(
14 feature = "postgres",
15 not(feature = "libsql"),
16 not(feature = "rusqlite"),
17))]
18pub trait FromRow: Sized {
19 const REQUIRED_COLUMNS: &'static [&'static str];
20
21 fn from_row(row: &tokio_postgres::Row) -> Result<Self, DbCoreError>;
25}
26
27#[cfg(all(
28 feature = "libsql",
29 not(feature = "postgres"),
30 not(feature = "rusqlite"),
31))]
32pub trait FromRow: Sized {
33 const REQUIRED_COLUMNS: &'static [&'static str];
34
35 fn from_row(row: &libsql::Row) -> Result<Self, DbCoreError>;
39}
40
41#[cfg(all(
42 feature = "rusqlite",
43 not(feature = "postgres"),
44 not(feature = "libsql"),
45))]
46pub trait FromRow: Sized {
47 const REQUIRED_COLUMNS: &'static [&'static str];
48
49 fn from_row(row: &rusqlite::Row<'_>) -> Result<Self, DbCoreError>;
53}
54
55#[cfg(all(feature = "postgres", feature = "libsql", not(feature = "rusqlite"),))]
56pub trait FromRow: Sized {
57 const REQUIRED_COLUMNS: &'static [&'static str];
58
59 fn from_pg_row(row: &tokio_postgres::Row) -> Result<Self, DbCoreError>;
63
64 fn from_libsql_row(row: &libsql::Row) -> Result<Self, DbCoreError>;
68}
69
70#[cfg(all(feature = "postgres", feature = "rusqlite", not(feature = "libsql"),))]
71pub trait FromRow: Sized {
72 const REQUIRED_COLUMNS: &'static [&'static str];
73
74 fn from_pg_row(row: &tokio_postgres::Row) -> Result<Self, DbCoreError>;
78
79 fn from_rusqlite_row(row: &rusqlite::Row<'_>) -> Result<Self, DbCoreError>;
83}
84
85#[cfg(all(feature = "libsql", feature = "rusqlite", not(feature = "postgres"),))]
86pub trait FromRow: Sized {
87 const REQUIRED_COLUMNS: &'static [&'static str];
88
89 fn from_libsql_row(row: &libsql::Row) -> Result<Self, DbCoreError>;
93
94 fn from_rusqlite_row(row: &rusqlite::Row<'_>) -> Result<Self, DbCoreError>;
98}
99
100#[cfg(all(feature = "postgres", feature = "libsql", feature = "rusqlite",))]
101pub trait FromRow: Sized {
102 const REQUIRED_COLUMNS: &'static [&'static str];
103
104 fn from_pg_row(row: &tokio_postgres::Row) -> Result<Self, DbCoreError>;
108
109 fn from_libsql_row(row: &libsql::Row) -> Result<Self, DbCoreError>;
113
114 fn from_rusqlite_row(row: &rusqlite::Row<'_>) -> Result<Self, DbCoreError>;
118}
119
120#[cfg(not(any(
122 all(
123 feature = "postgres",
124 not(feature = "libsql"),
125 not(feature = "rusqlite")
126 ),
127 all(
128 feature = "libsql",
129 not(feature = "postgres"),
130 not(feature = "rusqlite")
131 ),
132 all(
133 feature = "rusqlite",
134 not(feature = "postgres"),
135 not(feature = "libsql")
136 ),
137 all(feature = "postgres", feature = "libsql", not(feature = "rusqlite")),
138 all(feature = "postgres", feature = "rusqlite", not(feature = "libsql")),
139 all(feature = "libsql", feature = "rusqlite", not(feature = "postgres")),
140 all(feature = "postgres", feature = "libsql", feature = "rusqlite"),
141)))]
142pub trait FromRow: Sized {
143 const REQUIRED_COLUMNS: &'static [&'static str];
144}