use rusqlite::Row;
use crate::catalog::CatalogVersion;
use crate::fromdb::FromDb;
use crate::lrobject::{LrId, LrObject};
pub struct LibraryFile {
id: LrId,
uuid: String,
pub basename: String,
pub extension: String,
pub folder: LrId,
pub sidecar_extensions: String,
}
impl LrObject for LibraryFile {
fn id(&self) -> LrId {
self.id
}
fn uuid(&self) -> &str {
&self.uuid
}
}
impl FromDb for LibraryFile {
fn read_from(_version: CatalogVersion, row: &Row) -> crate::Result<Self> {
Ok(LibraryFile {
id: row.get(0)?,
uuid: row.get(1)?,
basename: row.get(2)?,
extension: row.get(3)?,
folder: row.get(4)?,
sidecar_extensions: row.get(5)?,
})
}
fn read_db_tables(_version: CatalogVersion) -> &'static str {
"AgLibraryFile"
}
fn read_db_columns(_version: CatalogVersion) -> &'static str {
"id_local,id_global,baseName,extension,folder,sidecarExtensions"
}
}
impl LibraryFile {}