query:'SELECT * FROM projects WHERE number_one = ANY(?) AND number_two = ANY(?) AND number_three = ANY(ARRAY[?, number_one]) AND number_four > ?;',
params:[[1,2,3],[1,2,3],42,1337],
placeholders:[]
}
*/
// SELECT country_id, store_id, color, size, COUNT(*) AS total_sold, SUM(price) AS total_revenue FROM sales GROUP BY color, size, ROLLUP (country_id, store_id);
// FIXME: For query generation, ensure we are generating correct queries for TRUE/FALSE/NULL/NOTNULL (in particular, moreThan/lessThan should not allow these!)
// FIXME: Partial indexes
// FIXME: not(anyOf(...))
// FIXME: anyOfValues rendering without arrayify optimizer
// TODO: Allow specifying placeholders that can be filled in later, for truly reusable query builders (so that eg. query planning only needs to be done once, this could even use prepared statements under the hood)
// let query = select("projects", [
// where(allOf([
// { score: not(lessThan(anyOf([ a, b, parameter("score") ]))) },
// anyOf([
// { active: true },
// { always_show: true }
// ])
// ]))
// ]);
// let query = select("projects", [
// where({
// active: true,
// // score: not(lessThan(anyOf([ a, b, c ])))
// // MARKER: Implement parameter tracking, so that the below can be made to work (needs a `placeholder` query gen handler that just returns parameter metadata or something, and this should be used elsewhere as well, and the anyOf/allOf code should be updated to also check for placeholders, not just SQL expressions)
// score: not(lessThan(anyOf([
// a,
// b,
// sql("44 + 33"),
// parameter("foo")
// ])))
// })
// ]);
// FIXME: Pre-processing (eg. inverse case-mapping for inserted objects or WHERE clauses) - maybe pre-processing that subscribes to particular operations? Something along the lines of axios interceptors perhaps
// FIXME: `either`/`all` for OR/AND representation respectively?
// FIXME: I guess `withDerived` could be implemented externally, as something that (depending on value type) either a) adds a field selector or b) adds a post-processing hook