Skip to content

Commit

Permalink
Add TypeScriptTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabigeek committed May 12, 2021
1 parent 2e9b4cd commit c43d6c9
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/lib/TypeScriptTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { PostgresMeta } from "."

export default class TypeScriptTypes {
pgMeta: PostgresMeta

constructor() {
this.pgMeta = new PostgresMeta({
connectionString: "postgres://postgres:postgres@localhost:5432/postgres",
max: 1
})
}

async dump(): Promise<any> {
const { data, error } = await this.pgMeta.columns.list();
// TODO: handle error

if (data) {
return data.reduce((prev, current) => {
if (current.table in prev) {
prev[current.table].push(current)
} else {
prev[current.table] = []
}

return prev
}, {} as { [key: string]: Array<any> })
}
}
}


new TypeScriptTypes().dump().then(console.log)

0 comments on commit c43d6c9

Please sign in to comment.