K
Kysely12mo ago
mike

How to plugin column aliases with table prefix?

I am not familiar with kysely plugin creation. I am also not sure if my issue can be done with such a plugin. My aim is to have overload method like this:
.selectAll('t1', 'prefix_t1')
.selectAll('t1', 'prefix_t1')
so the resulted query will be:
select t1.column1 as "prefix_t1.column1", t2.column2 as "prefix_t1.column2", etc.
select t1.column1 as "prefix_t1.column1", t2.column2 as "prefix_t1.column2", etc.
would it be possible with plugins or any other (even existing) solution in kysely? Thank you
4 Replies
koskimas
koskimas12mo ago
It's not possible to overload methods using plugins. It's very difficult to overload Kysely methods using any technique. It's better to keep kysely as just a query builder and build an abstraction layer on top of it.
mike
mike12mo ago
but how would you suggest to do it as abstraction layer on top of it? use some crazy-name alias and post progress regex string replacement? and if this is not possible. is it worth to create an issue for this as a requested new feature?
koskimas
koskimas12mo ago
Not worth opening an issue. Kysely is not designed to be extendable. You should use it as a dumb query builder and not try to turn it into an ORM.
mike
mike12mo ago
ok
Want results from more Discord servers?
Add your server