Skip to main content

insert_event

Function insert_event 

Source
pub fn insert_event(conn: &Connection, e: &UsageEvent) -> Result<bool>
Expand description

INSERT OR IGNORE — returns true if the row was new, false if uuid collided with an existing event. Events without uuid are always inserted (no dedupe key), so callers should prefer to set uuid whenever possible.

usage_events.tool_id has a FOREIGN KEY into tools(id) and SQLite foreign-key enforcement is on for this connection — callers MUST upsert a matching tools row before inserting events for it. The session_jsonl replay ingestor skips events for un-catalogued tool ids.