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

Supports multiple database connections #225

Open
zKoz210 opened this issue Aug 13, 2024 · 1 comment
Open

Supports multiple database connections #225

zKoz210 opened this issue Aug 13, 2024 · 1 comment
Labels
feature request Request for new feature implementation

Comments

@zKoz210
Copy link

zKoz210 commented Aug 13, 2024

Proposal

Discussion:

I've worked a lot with Laravel and there is a handy thing like DB::connection() that allows you to connect multiple databases to one project. It would be really cool to see it here!

For example:

  1. I use PostgreSQL as my main transactional database
  2. ClickHouse is used to collect certain development metrics and analytics

And I would like to conveniently be able to set all connections through the configuration and refer to them by name

connection - pgsql
connection - ch
connection - ch_analytics

@System-Glitch System-Glitch added the feature request Request for new feature implementation label Aug 13, 2024
@System-Glitch
Copy link
Member

This would be an interesting addition indeed. It would require a design phase so it is correctly included in the framework. This will probably involve breaking changes so it would be pushed back to v6.

In the meantime, you can work around this by opening another connection yourself using database.New(cfg, func() *slog.Logger { return server.Logger }) (or manually as usual in a Go project) and exposing this new connection through a service.

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

No branches or pull requests

2 participants