mjwwit / kanel

Generate Typescript types from Postgres

Home Page:https://kristiandupont.github.io/kanel/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kanel Logo Kanel Logo

Generate Typescript types from a live Postgres database.

This is for people who don't like ORM's but who do like intellisense and type checking for their database access code.

See the documentation here

Introduction to the idea is outlined here.

Note: If you are migrating from v2, there are significant breaking changes. There is a breakdown in the documentation.

Usage

Install with:

$ npm i -D kanel

To run, make sure you are in a folder that has a .kanelrc.js configuration file and that your database is running, and type:

$ npx kanel

Programmatical usage

Example of running generation from code:

import { processDatabase } from 'kanel';
import config from './kanelrc';

async function run() {
  await processDatabase(config);
}

run();

Example

To see an example of the result, check out the /example folder. It uses the Sample Database from www.postgresqltutorial.com.



Contributors

Made with contrib.rocks.

About

Generate Typescript types from Postgres

https://kristiandupont.github.io/kanel/

License:MIT License


Languages

Language:TypeScript 95.7%Language:JavaScript 3.5%Language:CSS 0.8%