feat: add missing database functions and fix tool errors
Co-authored-by: aider (openai/andrew/openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
This commit is contained in:
31
src/db.rs
31
src/db.rs
@@ -87,6 +87,37 @@ pub fn insert_item(conn: &Connection, item: Item) -> Result<i64> {
|
||||
Ok(conn.last_insert_rowid())
|
||||
}
|
||||
|
||||
pub fn create_item(conn: &Connection, compression_type: crate::compression_engine::CompressionType) -> Result<Item> {
|
||||
let item = Item {
|
||||
id: None,
|
||||
ts: chrono::Utc::now(),
|
||||
size: None,
|
||||
compression: compression_type.to_string(),
|
||||
};
|
||||
let item_id = insert_item(conn, item.clone())?;
|
||||
Ok(Item {
|
||||
id: Some(item_id),
|
||||
..item
|
||||
})
|
||||
}
|
||||
|
||||
pub fn add_tag(conn: &Connection, item_id: i64, tag_name: &str) -> Result<()> {
|
||||
let tag = Tag {
|
||||
id: item_id,
|
||||
name: tag_name.to_string(),
|
||||
};
|
||||
insert_tag(conn, tag)
|
||||
}
|
||||
|
||||
pub fn add_meta(conn: &Connection, item_id: i64, name: &str, value: &str) -> Result<()> {
|
||||
let meta = Meta {
|
||||
id: item_id,
|
||||
name: name.to_string(),
|
||||
value: value.to_string(),
|
||||
};
|
||||
store_meta(conn, meta)
|
||||
}
|
||||
|
||||
pub fn update_item(conn: &Connection, item: Item) -> Result<()> {
|
||||
debug!("DB: Updating item: {:?}", item);
|
||||
conn.execute(
|
||||
|
||||
Reference in New Issue
Block a user