in ,

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.

TypeScript

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

Documented

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;}

#Changes

If you upgrade, please seev5 beraking changes.

Brave Browser
Read More
Payeer

What do you think?

Leave a Reply

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

GIPHY App Key not set. Please check settings

SpaceX Launches Dragon Cargo Ship to Space Station for NASA, Sticks Rocket Landing – Space.com, Space.com

SpaceX Launches Dragon Cargo Ship to Space Station for NASA, Sticks Rocket Landing – Space.com, Space.com

Radiolab co-host to depart podcast after 15 years, Ars Technica

Radiolab co-host to depart podcast after 15 years, Ars Technica