sql-ts-knex-generator
TypeScript icon, indicating that this package has built-in type declarations

1.8.1 • Public • Published

A simple command line tool to generate typescript CRUD operations

Generate CRUD operations and TypeScript interfaces from database schemas.

Supports the following databases: MySQL, Microsoft SQL Server, SQLite and PostgreSQL.

How to use

npx sql-ts-knex-generator -c ./config.json

example config file:

{
  "client": "mssql",
  "tables": ["dbo.TABLE_NAME"],
  "connection": {
    "server": "********",
    "database": "*******",
    "user": "*******",
    "password": "********",
    "options": {
      "encrypt": true,
      "enableArithAbort": true
    },
    "requestTimeout": 15000,
    "connectionTimeout": 15000
  }
}

It will create a folder and generate a file for each table containing CRUD (create, read, update, delete) functions based on DB schema.

It respects nullable and required fields.

Config file options

Config file options OR sql-ts docs

Credits:

Dependencies (5)

Dev Dependencies (18)

Package Sidebar

Install

npm i sql-ts-knex-generator

Weekly Downloads

55

Version

1.8.1

License

MIT

Unpacked Size

180 kB

Total Files

24

Last publish

Collaborators

  • saostad