listSchemas method

  1. @override
Future<List<SchemaNamespace>> listSchemas()
override

Lists the schemas/namespaces available in the connection.

Implementation

@override
Future<List<SchemaNamespace>> listSchemas() async {
  final sql = _schemaCompiler.dialect.compileSchemas();
  if (sql == null) {
    throw UnsupportedError('PostgreSQL should support schema listing');
  }

  final rows = await queryRaw(sql);
  return rows
      .map(
        (row) => SchemaNamespace(
          name: row['name'] as String,
          owner: row['owner'] as String?,
          isDefault: row['is_default'] as bool? ?? false,
        ),
      )
      .toList(growable: false);
}