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

[Request] Add multiple DB endpoints for reader/writer #1037

Closed
reesmanp opened this issue Oct 25, 2024 · 2 comments · May be fixed by #1085
Closed

[Request] Add multiple DB endpoints for reader/writer #1037

reesmanp opened this issue Oct 25, 2024 · 2 comments · May be fixed by #1085
Labels
enhancement New feature or request stale

Comments

@reesmanp
Copy link

I know that ProxySQL exists but it would be nice to be able to give Bun a writer endpoint and 0+ reader endpoints and have it decide which connection to use. I know this is an extension of the usecase of Bun but it still would be great to have, even as a hook or part of pgdriver's config.

@vmihailenco
Copy link
Member

I think the first version can be quite simple:

db := bun.NewDB(sqldb, dialect, bun.WithReadOnlyDB(db2))

And then use the db2 when calling db.NewSelect.

Copy link

This issue has been automatically marked as stale because it has not had activity in the last 30 days. If there is no update within the next 7 days, this issue will be closed.

@github-actions github-actions bot added the stale label Dec 21, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants