kysely-org / kysely

A type-safe typescript SQL query builder
https://kysely.dev
MIT License
10.47k stars 267 forks source link

[FEATURE REQUEST] enum tables #963

Closed carlpaten closed 5 months ago

carlpaten commented 5 months ago

Coming from a Hasura background, I'm used to being able to define enum tables.

An enum table is a table whose rows are understood to represent values in an enum type. Example:

Then I'd like Kysely to recognize that db.selectFrom("teacup").select("color") has type ("red" | "green" | "blue")[].

This is the single feature I find myself missing from Hasura.

koskimas commented 5 months ago

Kysely doesn't detect anything. It only operates on the types you provide it. Just provide the correct type for that column in your table interface and it already works.

If you're using some type generator, note that they are all third party libraries and we don't maintain or develop them. We have no control over their features.