-
Notifications
You must be signed in to change notification settings - Fork 65
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
🤗 [Question]: Can we add an option to database storages accept a already initialized connection? #967
Comments
I've checked and some stores already have this, just a few don't allow it. storage/postgres accepts a conn |
@ReneWerner87 We could do this by adding |
@mirusky Btw you are using the old Redis Driver. The latest one |
Yes, sounds good |
I just write the on mobile, I didn't saw I used the previous version, but I checked my code on production and it's using the v2. Thx for pointing out.
Sounds good |
@mirusky Planning PR for this weekend |
@mirusky @ReneWerner87 i'm adding this as an alternative to New() when creating the storage, does that make sense? Example conn := UniversalClient(...)
store = redis.Open(conn) At that point |
Yes makes sense |
Question Description
For example my app already opens a connection with redis and I'd like to reuse the same connection, since it's simple to create a health check endpoint that's only checks one redis connection instead of 2 or more.
Currently I'm opening 3 connections since my code opens 1 and I call
redis.New
twice, so I need to get the remaining connections usingstore.Conn
and pass it as dependency to my health check controller to check all connections.I'd like to know if it's possible to add an option to database driven storages like "Conn" that we can pass a already established connection. Something simillar to GORM/Existing database connection
Code Snippet (optional)
Checklist:
The text was updated successfully, but these errors were encountered: