cove-chat/cove-db/src/query/mod.rs
CanadianBaconBoi c62bb41cd4 Add User Handling to CoveDb
and..
- Add Delete SqlPart
- Cleanup imports
2026-02-23 16:22:26 +01:00

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
}
}