Skip to content

buzz-db: structured EventQuery builder for dynamic SQL #21

Description

@TheSentinel454

EventQuery is a 15-field struct translated into dynamic SQL via manual QueryBuilder logic (~300 lines in query_events_on and count_events_on in event.rs). The translation has grown organically with conditionals for filter combinations. Extracting query-building into a builder pattern with unit-testable SQL generation (without hitting Postgres) would improve maintainability as filter complexity grows. Priority: Low — not broken but increasingly fragile.

🤖 AI review update (2026-08-23)

Reframe this around shared predicate generation and validation rather than a public fluent builder. EventQuery already represents filter input; the maintainability risk is duplicated conditional SQL between query/count paths. Extract pure validation plus a shared predicate applicator where SQLx lifetimes allow, and test SQL shape alongside Postgres-backed semantic cases.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions