crudely-typed icon indicating copy to clipboard operation
crudely-typed copied to clipboard

Simple "everyday CRUD" Postgres queries with perfect TypeScript types

Results 8 crudely-typed issues
Sort by recently updated
recently updated
newest added

Write docs on: - [ ] Goals of the project - [ ] When you should use it vs. PgTyped or something else - [x] How to set it up...

Not 100% clear to me whether these can be generated -- I believe pg requires the name of the constraint that's violated. Or maybe not. There's an example of this...

The insert / update / delete queries all have `RETURNING *` hard-coded. This gets you all the data you could possibly need, but sometimes it's more than you want. It...

- [ ] Split select unit/type tests - [x] Add unit tests to check that all queries are idempotent - [x] Run pg-to-ts on the test schema via GitHub actions...

~See https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry~

It's [possible][1] for a postgres primary key to include multiple columns. I believe pg-to-ts already supports this. crudely-typed should support it with the "ByPrimaryKey" methods, e.g. `selectByPrimaryKey`. [1]: https://stackoverflow.com/questions/23533184/primary-key-for-multiple-column-in-postgresql

The `Queryable` interface assumes you're using node-postgres, i.e. the [`pg`](https://www.npmjs.com/package/pg) package. But it shouldn't be too hard to support [`pg-promise`](https://www.npmjs.com/package/pg-promise) as well, or at least to include an example of...

pg-to-ts emits a `requiredForInsert` list and there's a `TableInsert`. crudely-typed shouldn't allow users to disallow a column that's required for insert. See also https://github.com/danvk/pg-to-ts/issues/18