Consensus on immutable vs. mutable result for .executeTakeFirst
Hi folks, love Kysely, thanks for your work.
Is there a consensus on whether or not the query result for
executeTakeFirst
should be immutable? Or is this up to the dialect/not a concern of Kysely?
I'm asking because I seem to have found an inconsistency with kysely-libsql where the result of executeTakeFirst
is immutable, but this isn't the case for built-in dialects (checked Sqlite and Pg).
Wanted to get your thoughts on this so I can figure out if it's more appropriate to raise an issue with the dialect or if I should deal with this in a library that integrates Kysely.
Thanks!Solution:Jump to solution
The result is not meant to be immutable. It's up to the dialect and the underlying driver. Unless you use something like
CamelCasePlugin
, Kysely doesn't touch the result in any way. It just returns what the driver returns.3 Replies
Solution
The result is not meant to be immutable. It's up to the dialect and the underlying driver. Unless you use something like
CamelCasePlugin
, Kysely doesn't touch the result in any way. It just returns what the driver returns.It seems that kysely-libsql also doesn't touch the data. The driver it uses is probably responsible
The client being
@libsql/hrana-client
Ok, in that case, since mutability/immutability here is up to the dialect, looks like it would be more appropriate to deal with this downstream; not an issue with the dialect.
Thanks 👍