Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Decorators support #18

Closed
0xDing opened this issue Nov 18, 2021 · 1 comment
Closed

RFC: Decorators support #18

0xDing opened this issue Nov 18, 2021 · 1 comment
Labels
api Related to library's API enhancement New feature or request typescript Related to Typescript wontfix This will not be worked on

Comments

@0xDing
Copy link

0xDing commented Nov 18, 2021

Big Thanks to @koskimas for writing this amazing library.

Did kysely consider supporting class-based type definition? Different from interface, class support decorators. And it's which helps us to implement more powerful and flexibility features.

For example:

Typescript property decorators could set metadata for the class. This means we can use the KyselyPlugin to create plugins like auto-update updatedAt, encrypted fields, hashed password, etc.

And this can also be used to solve the problem in #5

This can make kysely more powerful than sql builder and more flexible than ORM

@koskimas
Copy link
Member

koskimas commented Nov 18, 2021

Thanks 🍻

I specifically didn't use classes by choice. They bring more problems than they solve. For example if you do something like Pick<SomeClass, 'someProperty'> for a class, the result is no longer the class in any way, even though the wanted result is "the class without other properties than someProperty".

I'm also the author of objection.js and one of the design choices I regret the most is using classes for defining the models.

Kysely doesn't try to do anything else but build and execute queries. You should implement everything else in a layer on top of Kysely.

@igalklebanov igalklebanov added enhancement New feature or request api Related to library's API wontfix This will not be worked on typescript Related to Typescript labels Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to library's API enhancement New feature or request typescript Related to Typescript wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants