Alex Mikhalev 47f563c0a9
Some checks failed
continuous-integration/drone/push Build is failing
Rename section to zone
2020-10-14 20:00:54 -06:00

17 lines
391 B
Rust

use sprinklers_core::model::Zone;
use rusqlite::{Error as SqlError, Row as SqlRow, ToSql};
pub fn from_sql<'a>(row: &SqlRow<'a>) -> Result<Zone, SqlError> {
Ok(Zone {
id: row.get(0)?,
name: row.get(1)?,
interface_id: row.get(2)?,
})
}
#[allow(dead_code)]
pub fn as_sql(zone: &Zone) -> Vec<&dyn ToSql> {
vec![&zone.id, &zone.name, &zone.interface_id]
}