1use rusqlite::Row;
8
9use crate::catalog::CatalogVersion;
10use crate::fromdb::FromDb;
11use crate::lrobject::{LrId, LrObject};
12
13pub struct LibraryFile {
16 id: LrId,
17 uuid: String,
18 pub basename: String,
20 pub extension: String,
22 pub folder: LrId,
24 pub sidecar_extensions: String,
26}
27
28impl LrObject for LibraryFile {
29 fn id(&self) -> LrId {
30 self.id
31 }
32 fn uuid(&self) -> &str {
33 &self.uuid
34 }
35}
36
37impl FromDb for LibraryFile {
38 fn read_from(_version: CatalogVersion, row: &Row) -> crate::Result<Self> {
39 Ok(LibraryFile {
40 id: row.get(0)?,
41 uuid: row.get(1)?,
42 basename: row.get(2)?,
43 extension: row.get(3)?,
44 folder: row.get(4)?,
45 sidecar_extensions: row.get(5)?,
46 })
47 }
48 fn read_db_tables(_version: CatalogVersion) -> &'static str {
49 "AgLibraryFile"
50 }
51 fn read_db_columns(_version: CatalogVersion) -> &'static str {
52 "id_local,id_global,baseName,extension,folder,sidecarExtensions"
53 }
54}
55
56impl LibraryFile {}