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

Open
reesmanp opened this issue Oct 25, 2024 · 1 comment · May be fixed by #1085
Open

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

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants