searchRowToParameters method
Converts a SearchRow to a value binding map of named SQL parameters.
Implementation
Map<String, Object> searchRowToParameters(SearchRow row) {
late final premsg = "SearchIndex[name=$name].searchRowToParameters:";
checkState(
columns.length == row.length,
message: () =>
"$premsg the search row size (${row.length}) does not match "
"the number of columns (${columns.length})",
);
var fn = (int i, SearchColumn c) {
if (row[c.name] case var value?)
return MapEntry(":$i", value);
else
throw StateError(
"$premsg cannot find the value for the column (${c.name}) "
"in the search row (row keys: ${row.keys})",
);
};
return Map.fromEntries(columns.mapIndexed(fn));
}