(connection: Connection)
| 74 | }; |
| 75 | |
| 76 | const getDatabases = async (connection: Connection): Promise<string[]> => { |
| 77 | const client = await newPostgresClient(connection); |
| 78 | if (connection.database) { |
| 79 | await client.end(); |
| 80 | return [connection.database]; |
| 81 | } |
| 82 | |
| 83 | const { rows } = await client.query(`SELECT datname FROM pg_database;`); |
| 84 | await client.end(); |
| 85 | const databaseList = []; |
| 86 | for (const row of rows) { |
| 87 | if (row["datname"]) { |
| 88 | databaseList.push(row["datname"]); |
| 89 | } |
| 90 | } |
| 91 | await client.end(); |
| 92 | return databaseList; |
| 93 | }; |
| 94 | |
| 95 | const getTableSchema = async (connection: Connection, databaseName: string): Promise<Schema[]> => { |
| 96 | connection.database = databaseName; |
no test coverage detected