oof2win2
Explore posts from serversImplementing D1 batching (getting typed queries as input and returning typed InferResult)
Hi. I've wanted to get D1 batching to work, so I've tried doing as below. Functionally the code works, however I would like to get the proper type safety for this. Essentially I extend Kysely to add the
executeBatch
method and I want to infer the results for each of the individual queries. Is this possible?9 replies
Accessing underlying methods on the client
Hi. I'm using libsql and I want to batch statements to be sent to the database. The underlying clients have these methods implemented, so I was wondering if it were possible to access these underlying methods from the
Kysely
class itself, or if it is necessary for me to write my own extension of the class to achieve this7 replies
Update on conflict clause
Hi. I need to use the on conflict clause in an update query within sqlite. I've searched the docs in mysql and it isn't present there. I created an example below for replication of the desired behavior. The only thing that I can think of is using the template sql`` operator from kysely, but is there a better way?
4 replies
can kysely be extended with custom types within the database
hi. i would like to extend my database with custom types (a date type for sqlite) so that it is easier to work with. i would assume that conversion to sql would be easy since its just a stringify operation using sql template tags, but is there a way to automatically convert from the database results, i.e. parse a ISO string into a Date object?
5 replies
building kysely makes the package size very large
hi. i'd be more than happy to figure this out because i like kysely a lot more than drizzle. the thing was that the package size was so much larger with drizzle. i made a repro here. when running
bun build --minify --outfile
, i get kysely to be 340.40kB whilst drizzle is 55.35kB, meanwhile the functional code besides the database is identical78 replies
Querying on jsonArrayFrom
Hi. So i need to fetch posts with comments from a database that are written by a set group of authors and have comments that are written by a set group of people. How would I accomplish this with sql? The best thing I can think of is fetch all posts and comments where the posts are written by the authors, and then do further clientside filtering on the comments - but is there a way to do this with the sql itself?
7 replies
transforming database values to JS values (dates in sqlite)
hi. is it possible to transform database values with any driver into any JS value? such as integers to timestamps on specified columns? i want to do this for sqlite and other databases but idk how
4 replies
Support for D1 batching
Hi. I'm wondering about support for batching statements with Cloudflare's D1 batching, similar to libsql's batching - i.e. multiple statements are sent and processed at once similar to a transaction, except it all occurs within the database driver itself. Can I somehow go about extending kysely or my dialect to add support for this? I.e. some dialect-specific functions i guess?
4 replies
Using a custom HTTP driver for Kysely
Hi. I want to use neondb as my database. The issue is that I can't create a PostgresDialect class instance from the default provided pool, as that uses websockets - which is not what I want. Is there a way to tell Kysely to use HTTP connections (such as with
kysely-planetscale
), or do I need to make the driver myself?7 replies
Is there a way to not have as many Selectable<> generics?
Hi. I'm using
prisma-kysely
to generate my Kysely types, and it generates them with the Generated generic. I therefore need to use the Selectable generic to change it to the return type of what is selected when I want to use the type. Is there a way to avoid using it so often?13 replies
Achieve Prisma-like nested selects
Hi. Is it possible to achieve Prisma-like nested selects with Kysely? I have the following code and it has the type below in Prisma, but I'm not sure how to achieve the same in Kysely without just doing an additional
select * from CommitteeCountry where id in (select id from Committee)
or something along those lines and then mapping the results in JS
15 replies