milestone 30: overview as a dashboard, explicit health contract, period aggregations
This commit is contained in:
@@ -172,6 +172,24 @@ pub fn resolveActiveByKey(
|
||||
return database.changes() != 0;
|
||||
}
|
||||
|
||||
const resolve_by_code_sql =
|
||||
\\UPDATE operational_events SET resolved_at = ?2
|
||||
\\ WHERE code = ?1 AND resolved_at IS NULL
|
||||
;
|
||||
|
||||
/// Closes every open episode of `code`, and returns how many. The store uses it
|
||||
/// once at init for a code no emitter writes any more: an episode whose producer
|
||||
/// no longer exists can never demonstrate recovery, so nothing but this would
|
||||
/// ever close it.
|
||||
pub fn resolveActiveByCode(database: *db.Db, now_s: i64, code: []const u8) db.Error!i64 {
|
||||
var stmt = try database.prepare(resolve_by_code_sql);
|
||||
defer stmt.deinit();
|
||||
try stmt.bindText(1, code);
|
||||
try stmt.bindInt(2, now_s);
|
||||
try stmt.exec();
|
||||
return database.changes();
|
||||
}
|
||||
|
||||
const select_active_id_sql =
|
||||
"SELECT id FROM operational_events WHERE code = ?1 AND subject_key = ?2 AND resolved_at IS NULL";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user