Solved: Exporting query builder classes

I saw this PR https://github.com/kysely-org/kysely/pull/763 where you guys have decided not to export classes as they are private. Is there any specific reason for which you don't want to make these classes public? Because if you change the public API of these classes, then anyways the query builder will be impacted by the change.
GitHub
export SelectQueryBuilderImpl by Andersgee · Pull Request #763 · ky...
We have been adding an alternative .execute(). I noticed that the actual class (implementation) for SelectQueryBuilder is not exported in recent versions. The classes for update, delete and insert ...
koskimas
koskimas40d ago
If we add public methods to the private class, those don't affect the public API if we don't add the methods to the public interface. Having a private implementation class allows us to add methods to the class that can be called by the internals but not by the users. Of course the users can cast the instance to any or whatever and just call the hidden methods, but that's clearly a violation of the public API and none of our concern. People can shoot themselves in the foot if they really want. We just promise that the public interface works. Anything outside it can break at any time. That was the reasoning behind the choice. Another reason was my misinterpretation of some typescript performance issues. I planned to move away from classes to interfaces everywhere. But that's not happening anymore since I was wrong. I don't think we currently use any methods internally from the hidden class though. It might be ok to remove the interface and expose the class, just like all the other query builders.
virk
virk40d ago
Okay, I get it. So basically you have been exposing interfaces publicly and keeping classes for internal runtime usage. Yeah, I would personally love to have classes exported and also become the returning types, if that doesn't change a lot of internals
koskimas
koskimas40d ago
Yeah if we expose the class and not the interface we'd completely remove the interface.
virk
virk40d ago
Would you like me to create an issue for the same? Or is it something you want to re-evaluate and do it at your own pace?
koskimas
koskimas40d ago
Yeah, please create an issue. Otherwise this will get forgotten
Want results from more Discord servers?
Add your server
More Posts
building 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 au