getCountByFilter_ method

Future<int> getCountByFilter_(
  1. String? correlationId,
  2. String? filter
)

Gets a number of data items retrieved by a given filter.

This method shall be called by a public getCountByFilter method from child class that receives FilterParams and converts them into a filter function.

  • correlationId (optional) transaction id to trace execution through call chain.
  • filter (optional) a filter JSON object Return a number of objects that satifsy the filter.

Implementation

Future<int> getCountByFilter_(String? correlationId, String? filter) async {
  var query = 'SELECT COUNT(*) AS count FROM ' + this.quotedTableName_();
  if (filter != null && filter != "") {
    query += " WHERE " + filter;
  }
  var res = await client_!.query(query);

  var count = res.affectedRowCount;

  logger_.trace(
      correlationId, "Counted %d items in %s", [count, this.tableName_]);

  return count;
}