Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: add adapter system for database store #12

Merged
merged 10 commits into from
Apr 6, 2024
Merged

Conversation

Julien-R44
Copy link
Owner

@Julien-R44 Julien-R44 commented Apr 6, 2024

This PR decouples Knex from the bentocache database driver.

The database store now takes an adapter as parameter, and we ship two builtin adapters: Knex and Kysely.
Others will be able to make a prisma/drizzle or other adapter if required quite easily, just by implementing the DatabaseAdapter interface.


This results in multiples breaking changes:

  • the test suite has changed its API. You now have to go through createStore to pass your driver.
  • all mysqlDriver, sqliteDriver etc... have been removed: only knexDriver and kyselyDriver remain.
  • the knex driver will no longer create the knex instance. you'll have to create the instance yourself to pass it on to the adapter.

Copy link

cloudflare-workers-and-pages bot commented Apr 6, 2024

Deploying bentocache with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3bd4116
Status: ✅  Deploy successful!
Preview URL: https://14b4e693.bentocache.pages.dev
Branch Preview URL: https://feat-db-adapter.bentocache.pages.dev

View logs

@Julien-R44 Julien-R44 marked this pull request as ready for review April 6, 2024 13:39
@Julien-R44 Julien-R44 merged commit 08fff55 into main Apr 6, 2024
9 checks passed
@Julien-R44 Julien-R44 deleted the feat/db-adapter branch April 6, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant