bindQueryClauses function
Binds a query's where clauses ({field, op, param}, as the config and
the manifest carry them) to params, then adds the owner clause FFX
injects into an owner-bound query (its list rule is owner):
ownerField == endUserId. Throws FormatException for a clause that is
not that shape or names an operator outside queryOperators, so a
caller can tell a query it cannot run from one that matches nothing.
paramTypes is the query's declared params ({name: {type, …}}, the
manifest query's params). A timestamp param is bound as FFX binds it
(queries.ts): an RFC 3339 UTC string in the six-digit form stored values
carry (normalizeWireTimestamp), so …00.000Z from
DateTime.toIso8601String() meets …00.000000Z. FFX leaves every other
param, a list<timestamp> included, as sent.
Implementation
List<QueryClause> bindQueryClauses(
Iterable<Object?> where,
Map<String, Object?> params, {
String? ownerField,
String? endUserId,
Map<String, Object?>? paramTypes,
}) => [
for (final clause in where) _bindClause(clause, params, paramTypes),
if (ownerField != null) (field: ownerField, op: 'eq', value: endUserId),
];