48 lines
1020 B
Rust
48 lines
1020 B
Rust
use sqlx::postgres::PgQueryResult;
|
|
use crate::rows::{PartialTableRow, TableRow};
|
|
|
|
pub mod user;
|
|
|
|
pub struct PartialQueryResult<T: PartialTableRow> {
|
|
value: T,
|
|
pg_query_result: Option<PgQueryResult>
|
|
}
|
|
|
|
impl<T: PartialTableRow> PartialQueryResult<T> {
|
|
pub fn new(value: T, pg_query_result: Option<PgQueryResult>) -> Self {
|
|
PartialQueryResult {
|
|
value,
|
|
pg_query_result
|
|
}
|
|
}
|
|
|
|
pub fn value(&self) -> &T {
|
|
&self.value
|
|
}
|
|
|
|
pub fn result(&self) -> &Option<PgQueryResult> {
|
|
&self.pg_query_result
|
|
}
|
|
}
|
|
|
|
pub struct QueryResult<T: TableRow> {
|
|
value: T,
|
|
pg_query_result: Option<PgQueryResult>
|
|
}
|
|
|
|
impl<T: TableRow> QueryResult<T> {
|
|
pub fn new(value: T, pg_query_result: Option<PgQueryResult>) -> Self {
|
|
QueryResult {
|
|
value,
|
|
pg_query_result
|
|
}
|
|
}
|
|
|
|
pub fn value(&self) -> &T {
|
|
&self.value
|
|
}
|
|
|
|
pub fn result(&self) -> &Option<PgQueryResult> {
|
|
&self.pg_query_result
|
|
}
|
|
} |