countTablesIn method

  1. @override
Statement countTablesIn(
  1. List<String> tableNames
)
override

Counts tables whose name is included in tableNames.

Implementation

@override
Statement countTablesIn(List<String> tableNames) {
  final sql = '''
    SELECT COUNT(table_name)::integer AS "count"
      FROM information_schema.tables
        WHERE
          table_type = 'BASE TABLE' AND
          table_name IN (${tableNames.mapIndexed((i, _) => "\$${i + 1}").join(', ')});
  ''';
  return Statement(
    sql,
    [...tableNames],
  );
}