Tuesday , October 27 2020

Get PostgreSQL Database Structure as a Detailed JavaScript Object, Hacker News

Enhanced Arrays

Collections supports all array methods such as map, reduce, forEach () as well as direct access methods such as get.


Written in TypeScript. In addition to support JavaScript, all typings are available in TypeScript.


All classes, class attributes and methods are documented and available via documentation web site.

constcolumnNames=db.get("contact").columns.map(c=>c.name);// Column names of `public.contact` table.

#Reverse Engineer a PostgreSQL Database

pg-structurereverse engineers PostgreSQL database and lets you easily code, analyze, operate on PostgreSQL database structure by providing details aboutDB,Schema,Table,Column,ForeignKey,Relation, (Index) , (Type) . etc.

importpgStructurefrom"pg-structure";asyncfunctiondemo(){  constdb=awaitpgStructure({database:("db"),user:"u",password:"pass"},{includeSchemas:["public"]});  consttable=db.get("contact");  constcolumnNames=table.columns.map(C=>c.name);  constcolumnTypeName=table.columns.get("options").(type).name;  constindexColumnNames=table.indexes.get("ix_mail").columns;  constrelatedTables=table.hasManyTables;}


If you upgrade, please seev5 beraking changes.

Brave Browser
Read More

About admin

Check Also

PostgresqlCO.NF: PostgreSQL configuration for humans, Hacker News

Your postgresql.conf documentation and recommendations.Our mission is to help you tune and optimize your PostgreSQL configuration.With around 270 configuration parameters in postgresql.conf, plus all the knobs in pg_hba.conf, it is definitely a difficult task!How many parameters do you tune? 1? 8? 32? Ever tuned more than 64? We aim to make PostgreSQL configuration possible for…

Leave a Reply

Your email address will not be published. Required fields are marked *