doExistIDsSQL<I extends Object> method

  1. @override
FutureOr<List<I>> doExistIDsSQL<I extends Object>(
  1. String entityName,
  2. String table,
  3. SQL sql,
  4. Transaction transaction,
  5. PostgreSQLConnectionWrapper connection,
)
override

Implementation

@override
FutureOr<List<I>> doExistIDsSQL<I extends Object>(
    String entityName,
    String table,
    SQL sql,
    Transaction transaction,
    PostgreSQLConnectionWrapper connection) {
  if (sql.isDummy) return <I>[];

  return connection
      .mappedResultsQuery(sql.sql,
          substitutionValues: sql.parametersByPlaceholder)
      .resolveMapped((results) {
    var ids = results
        .map((e) => e[table])
        .whereType<Map<String, dynamic>>()
        .map((e) => e['id']);

    return parseIDs<I>(ids);
  });
}