getListByIds method
Gets a list of data items retrieved by given unique ids.
correlationId
(optional) transaction id to trace execution through call chain.ids
ids of data items to be retrieved Return a list with requested data items.
Implementation
Future<List<T>> getListByIds(String? correlationId, List<K> ids) async {
var params = this.generateParameters_(ids);
var query = "SELECT * FROM " +
this.quotedTableName_() +
" WHERE \"id\" IN(" +
params +
")";
var values = generateValues_(ids);
var res = await client_!.query(query, substitutionValues: values);
if (res.isNotEmpty) {
this.logger_.trace(
correlationId, "Retrieved %d from %s", [res.length, this.tableName_]);
} else {
return [];
}
var items = res
.map((e) => convertToPublic_(Map<String, dynamic>.fromIterables(
res.columnDescriptions.map((e) => e.columnName), e.toList())) as T)
.toList();
return items;
}