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

Refactoring to easily support other databases #228

Closed
haikyuu opened this issue Feb 9, 2023 · 3 comments
Closed

Refactoring to easily support other databases #228

haikyuu opened this issue Feb 9, 2023 · 3 comments

Comments

@haikyuu
Copy link

haikyuu commented Feb 9, 2023

First, thanks for open sourcing this. This is a great addition to the open-source world.

D1 and SQLite are great. But there are so many other choices for dbs.

What do you think about abstracting the db part just a bit to allow people who fork this project to swap it transparently?

import edgedbAdapter from './edgedbAdapter.js'

const config = { dbAdapter: edgedbAdapter }

The adapter would have a ts spec.

The db functions are already typed, so it wouldn't be hard to do the refactoring.

And in order to create an adapter, a user has to implement all the query functions in the adapter file.

I believe this will immensely help adoption of this project and create a vibrant ecosystem around it. Especially if db providers provide an adapter (supabase, mongo, prisma, edgedb ...).

Another use case is people who want to integrate this project into their existing system and database. I think you get the point :)

@erlend-sh
Copy link

erlend-sh commented Feb 18, 2023

Since it’s outside of wildebeest’s core directive as a Cloudflare-native app, I think the only way to know whether this would be approved is to make a small PR. Then the tentative changes can be discussed in the context of a proof-of-concept that clearly demonstrates the trade-offs.

xtuc added a commit that referenced this issue Feb 22, 2023
xtuc added a commit that referenced this issue Feb 22, 2023
@xtuc
Copy link
Member

xtuc commented Mar 1, 2023

The code has been refactored to allow other databases, based on D1's API interface. I'm adding neon.tech (postgresql) as another supported database.

@xtuc xtuc closed this as completed Mar 1, 2023
@haikyuu
Copy link
Author

haikyuu commented Mar 1, 2023

Thanks @xtuc this is amazing 🙌

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

No branches or pull requests

3 participants