use toolu_orm_core::error::DbCoreError;
use toolu_orm_core::row::FromRow;
pub struct ScalarRow {
pub value: i64,
}
impl FromRow for ScalarRow {
const REQUIRED_COLUMNS: &'static [&'static str] = &[];
fn from_row(row: &rusqlite::Row<'_>) -> Result<Self, DbCoreError> {
let value: i64 = row
.get(0)
.map_err(|e| DbCoreError::RowMapping(e.to_string()))?;
Ok(Self { value })
}
}
pub struct LabelRow {
pub label: String,
}
impl FromRow for LabelRow {
const REQUIRED_COLUMNS: &'static [&'static str] = &["label"];
fn from_row(row: &rusqlite::Row<'_>) -> Result<Self, DbCoreError> {
let label: String = row
.get(0)
.map_err(|e| DbCoreError::RowMapping(e.to_string()))?;
Ok(Self { label })
}
}