RobinBlomberg / kysely-codegen

Generate Kysely type definitions from your database.
MIT License
815 stars 73 forks source link

Add Support for `kysely-bun-sqlite` #173

Closed tlonny closed 4 months ago

tlonny commented 4 months ago

There seems to be two main bun compatible sqlite dialects that use bun's native bun:sqlite package.

These are:

kysely-bun-sqlite

kysely-bun-worker

From my testing and observations it seems as if the first option is:

  1. Better documented - with examples
  2. Works in all contexts (not just in a worker thread)

Unfortunately, we currently only support kysely-bun-worker.

I propose a slightly gross hack that tries creating the kysely-bun-worker dialect if the import for kysely-bun-sqlite fails.

I've tested it and it seems to work well.

I don't imagine this is ready for merge as-is but am happy to make modifications as requested.

Thanks for your consideration 👍

tlonny commented 4 months ago

If you think it would be better to handle this as a unique dialect (with its own CLI flag), I'm happy to re-do the PR - was just cognizant of polluting the dialect namespace....

Thanks