Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dts-sql

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dts-sql

generate TypeScript definition from SQL schema

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

dts-sql

A simple command line tool that generates TypeScript definition (*.d.ts) from SQL schema. Currently it only supports PostgreSQL.

Usage

usage: dts-sql DB_URI SCHEMA TABLE INTERFACE_NAME

DB_URI: Database URI
SCHEMA: Table schema
TABLE: From which table to generate the definition
INTERFACE_NAME: Interface name of the definition

Example

Assume we have had the sample tables loaded the database. We want to generate the definition for the employees table:

dts-sql postgresql://postgres:secret@localhost:5432/postgres public employees IEmployee

will print out:

export interface IEmployee {

    // integer
    'emp_no': number;

    // date
    'birth_date': Date;

    // character varying
    'first_name': string;

    // character varying
    'last_name': string;

    // gender
    'gender': any | null;

    // date
    'hire_date': Date;
}

License

MIT. See License file.

FAQs

Package last updated on 08 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc