Skip to main content

new_rules_since

Function new_rules_since 

Source
pub async fn new_rules_since(
    db: &SqlitePool,
    prev_ts_ms: Option<i64>,
    repo_aliases: &[String],
    limit: usize,
) -> Result<Vec<NewRule>, String>
Expand description

Query data.db for up to limit rules whose installed_at is later than prev_ts_ms (millis since epoch) AND whose source_repo matches one of repo_aliases (case-insensitive). When prev_ts_ms is None, the time filter is dropped and we return the limit most recent rules for the repo — that’s the “first session ever” case where every rule learned to date is genuinely new to the user.

Returns a Vec ordered newest-first. SQL errors propagate as Err(String) so the caller can fold into the “swallow and emit nothing” branch.