Custom Plugin to transform Alias.* to "Alias.Column1", "Alias.Column2", etc.
Hi everyone, in the previous question, I asked how to transform the following syntax into a new one. I was adviced to create my own plugin serializer (example: https://github.com/subframe7536/kysely-sqlite-tools/tree/master/packages/plugin-serialize). However, I still struggle with how to do it. Can anybody please give me a hint? I'll do it later by myself but need a guide how to start.
Thank you very much!
input syntax:
required result:
Unknown User•38d ago
Message Not Public
Sign In & Join Server To View
mike•37d ago
you mean debug and checkout inside the plugin, right?
koskimas•37d ago
Kysely doesn't have the data required to convert
selectAll('Alias')
into select(['Alias.Column1', 'Alias.Column2'])
. Kysely only knows about Column1
, Column2
etc. in the type level. You need to provide that information yourself somehow.
You can't create a plugin that'd also make the types aware of the new Alias.Column1
and Alias.Column2
column names
TLDR; It's impossible to create this plugin.mike•37d ago
😢
I've created class called KyselyBroker which consumes compiled-query and do some dynamic post-processing based on additional parameters and options so the result is easier to use in other db frameworks or ORMs. It's not fancy but it works. This one is however more complex - it's not just replace
this
with that
. I'll think about it. The whole think is we have a huge implementation of sequelize already and we combine it (not replace) with Kysely. We use Kysely where Sequelize struggles.Igal•37d ago
GitHub
GitHub - kysely-org/kysely-sequelize: A toolkit (dialect, type tran...
A toolkit (dialect, type translators, etc.) that allows using your existing Sequelize instance with Kysely. - kysely-org/kysely-sequelize
mike•36d ago
wow, I definitely haven't. I'll take a look for sure. Thank you
Igal•36d ago
Getting some feedback would be great!
1.4KMembers
View on DiscordWant results from more Discord servers?
More Postscan kysely be extended with custom types within the databasehi. i would like to extend my database with custom types (a date type for sqlite) so that it is easinewbie need help with json_build_objectHi! Just starting with kysely and encountered problem I cant solve. I want to build raw query with kSolved: Exporting query builder classesI saw this PR https://github.com/kysely-org/kysely/pull/763 where you guys have decided not to exporbuilding kysely makes the package size very largehi. i'd be more than happy to figure this out because i like kysely a lot more than drizzle. the thiKysely setup in monolith APIHello, we have a basic http server with a basic router and a PostgreSQL database. We're wondering whIs it possible to get the total count while fetching rows in a single query?I have a query which looks like this:
```typescript
const { items, count } = await db
.selectFrom(Separating results of join into objects of each typeHey guys, I'm curious if anyone knows a way to unmerge the results of a join into objects of both tySnippet compilationHi, is it somehow possible to get only part of the compiled code to use it as snippet in ORM? Or vicCreating an 'enum' type columnHi all,
Trying to re-create this MySQL in Kysely
```
...
CREATE TABLE ...(
...
members ENUM('femalError when destructuring QueryCreator in withRecursiveI'm new to Kysely and attempting to migrate a Next app from prisma to kysely. I've generated types, Is `sql.join` the best way to concatenate sql templates?I have some business logic that incrementally builds up a sql WHERE query as a string. It looks likeMultiple calls to values in insert statement?I just had a production bug where I was calling `.values` multiple times on a query object. I've fix0.27.3 is out. Didn't have time to write0.27.3 is out. Didn't have time to write release notes yet since it was a hotfix to support typescriusing pgvector with KyselyFollowing the example here: https://github.com/pgvector/pgvector-node?darkschemeovr=1#kysely
But I Static/reusable custom window functionsHello, I'm trying to buld a properly typed `array_agg` window function and would like to reuse the eIs the Kysely main site down?I just want to confirm if Kysely's main site is downOn Conflict do update set ALL to be inserted columnsHere I am once again with a question for the on conflict bit in postgres. Would there be a way to auHow to use kysely in edge runtime (like NextJS 14 middleware)?Error: The edge runtime does not support Node.js 'crypto' module.
Learn More: https://nextjs.org/dochow to write not (array1 && array2)Hi again,
how to write following code? I would love to use not(expression)
Expected result:
```
noPartial compileHello everyone, is it possible (somehow) to generate only part of the compiled query? I have an edge