use crate::section_interface::SectionId; use rusqlite::{Error as SqlError, Row as SqlRow, ToSql}; use std::sync::Arc; #[derive(Debug, Clone)] pub struct Section { pub id: u32, pub name: String, pub interface_id: SectionId, } impl Section { pub fn from_sql<'a>(row: &SqlRow<'a>) -> Result { Ok(Section { id: row.get(0)?, name: row.get(1)?, interface_id: row.get(2)?, }) } #[allow(dead_code)] pub fn as_sql(&self) -> Vec<&dyn ToSql> { vec![&self.id, &self.name, &self.interface_id] } } pub type SectionRef = Arc
;