We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2e9b4cd commit c43d6c9Copy full SHA for c43d6c9
src/lib/TypeScriptTypes.ts
@@ -0,0 +1,32 @@
1
+import { PostgresMeta } from "."
2
+
3
+export default class TypeScriptTypes {
4
+ pgMeta: PostgresMeta
5
6
+ constructor() {
7
+ this.pgMeta = new PostgresMeta({
8
+ connectionString: "postgres://postgres:postgres@localhost:5432/postgres",
9
+ max: 1
10
+ })
11
+ }
12
13
+ async dump(): Promise<any> {
14
+ const { data, error } = await this.pgMeta.columns.list();
15
+ // TODO: handle error
16
17
+ if (data) {
18
+ return data.reduce((prev, current) => {
19
+ if (current.table in prev) {
20
+ prev[current.table].push(current)
21
+ } else {
22
+ prev[current.table] = []
23
24
25
+ return prev
26
+ }, {} as { [key: string]: Array<any> })
27
28
29
+}
30
31
32
+new TypeScriptTypes().dump().then(console.log)
0 commit comments