# types-from-sql

Latest version **1.0.11** (published 2020-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install types-from-sql
pnpm add types-from-sql
yarn add types-from-sql
bun add types-from-sql
```

Provides the command `types-from-sql`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2020-06-08 |
| First published | 2020-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 13 |
| Unpacked size | 38.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Wit |
| Maintainers | o175 |
| Keywords | postgres, sql, type, interface, generator |

## Links

- npm: https://www.npmjs.com/package/types-from-sql
- Repository: git@github.com:o175/types-from-sql
- npm.io page: https://npm.io/package/types-from-sql

## Dependencies (13)

- [pg](https://npm.io/package/pg.md) ^8.0.3
- [pino](https://npm.io/package/pino.md) ^6.2.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [chokidar](https://npm.io/package/chokidar.md) ^3.4.0
- [@types/pg](https://npm.io/package/@types/pg.md) ^7.14.3
- [commander](https://npm.io/package/commander.md) ^5.1.0
- [fast-glob](https://npm.io/package/fast-glob.md) ^3.2.2
- [dataloader](https://npm.io/package/dataloader.md) ^2.0.0
- [@types/pino](https://npm.io/package/@types/pino.md) ^6.0.1
- [data-loader](https://npm.io/package/data-loader.md) ^2.9.1
- [@types/lodash](https://npm.io/package/@types/lodash.md) ^4.14.150
- [node-postgres](https://npm.io/package/node-postgres.md) ^0.1.4
- [camelcase-keys](https://npm.io/package/camelcase-keys.md) ^6.2.2

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 1.0.11 (latest) — 2020-06-08
- 1.0.10 — 2020-06-03
- 1.0.9 — 2020-05-21
- 1.0.8 — 2020-05-21
- 1.0.7 — 2020-05-21
- 1.0.6 — 2020-05-21
- 1.0.5 — 2020-05-18
- 1.0.4 — 2020-05-08
- 1.0.3 — 2020-05-07
- 1.0.2 — 2020-04-30
- 1.0.1 — 2020-04-30
- 1.0.0 — 2020-04-29

## README

Works only with Postgres. It reads pg connection options from enviroment variables

Usage:

```
PGPASSWORD=1 PGUSER=1 PGDATABASE=1 PGHOST=1.1.1.1 PGPORT=5432 npx types-from-sql 'select * from table'
```

`-f`  specify glob instead of query, `-fn` to set interface name to filename:

```
PGPASSWORD=1 PGUSER=1 PGDATABASE=1 PGHOST=1.1.1.1 PGPORT=5432 npx types-from-sql -f ./test/*.sql
```

also interface name can be set with directive `@InterfaceName` in comment on top of sql: 

```
 -- @InterfaceName: INotification
select * from table

```

redirect output to interface file with `>` operator:

```
PGPASSWORD=1 PGUSER=1 PGDATABASE=1 PGHOST=1.1.1.1 PGPORT=5432 npx types-from-sql -fn ./test/*.sql
```

See also sql builder with typecheck: https://github.com/xialvjun/ts-sql-plugin#readme

---
_Source: https://npm.io/package/types-from-sql · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
