Live sync JSON documents over Iroh
This commit is contained in:
parent
741bd202a8
commit
284207eb01
8 changed files with 370 additions and 7 deletions
|
|
@ -445,6 +445,24 @@ impl Store {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn list_document_resources(&self) -> Result<Vec<StoredDocumentResource>, StoreError> {
|
||||
let mut stmt = self.conn.prepare(
|
||||
r#"SELECT document_id, resource_id, name, state_json, updated_at_ms
|
||||
FROM document_resources ORDER BY name"#,
|
||||
)?;
|
||||
let rows = stmt.query_map([], |row| {
|
||||
Ok(StoredDocumentResource {
|
||||
document_id: row.get(0)?,
|
||||
resource_id: row.get(1)?,
|
||||
name: row.get(2)?,
|
||||
state_json: row.get(3)?,
|
||||
updated_at_ms: row.get(4)?,
|
||||
})
|
||||
})?;
|
||||
rows.collect::<Result<Vec<_>, _>>()
|
||||
.map_err(StoreError::from)
|
||||
}
|
||||
|
||||
pub fn upsert_file_root(&self, root: &StoredFileRoot) -> Result<(), StoreError> {
|
||||
self.conn.execute(
|
||||
r#"INSERT OR REPLACE INTO file_roots(
|
||||
|
|
|
|||
Loading…
Reference in a new issue