Skip to main content

update

Function update 

Source
pub fn update(
    conn: &Connection,
    id: i64,
    m: &NewMemory,
    expected_updated_at: Option<i64>,
) -> Result<bool, AppError>
Expand description

Updates an existing memory optionally guarded by optimistic concurrency.

When expected_updated_at is Some(ts) the row is only updated if its current updated_at equals ts. This protects concurrent edit calls from silently clobbering each other.

§Returns

Ok(true) when exactly one row was updated, Ok(false) when the optimistic check failed or the memory does not exist.

§Errors

Returns Err(AppError::Database) on any rusqlite failure.