Query Engine with Typed Filters
Hard · Modelling
Write runQuery(rows, query) that works like a tiny database query. Steps, in this order:
1. **where** (optional): keep rows matching the Filter. eq/neq use ===/!==. gt, gte, lt, lte are true only when the field is a number. in is true when the list includes the field value. contains is true when the field is a string that contains value, ignoring upper/lower case. { and: [...] } needs all (an empty list is true), { or: [...] } needs at least one (empty is false), { not: f } inverts.
2. **orderBy** (optional): sort by the keys in order (asc or desc), comparing values with < and >. Rows that tie on every key keep their original order.
3. **offset** (default 0) rows are skipped, then at most **limit** rows are kept (default: all).
4. **select**: each result row only contains the listed fields that exist on it.