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

Question - Database Context #24

Open
WildEgo opened this issue Sep 20, 2021 · 6 comments
Open

Question - Database Context #24

WildEgo opened this issue Sep 20, 2021 · 6 comments

Comments

@WildEgo
Copy link

WildEgo commented Sep 20, 2021

Hey guys was looking at this and seemed interesting, I was wondering can I change the database context on the fly?

Thank in advance!

@loeffel-io
Copy link
Member

Hey @WildEgo,

could you please provide more infos

Thanks!

@WildEgo
Copy link
Author

WildEgo commented Sep 20, 2021

I'm thinking of playing with this SaaS framework so I was wondering, can I change the database connection on the fly, for example one request has Conn1 and the other has a Conn2, they connect thru a middleware and the data should be accessible on the resolver

@loeffel-io
Copy link
Member

loeffel-io commented Sep 20, 2021

Yes, that's possible!

You can just use the gorm plugin https://github.com/go-gorm/dbresolver or multiple db instances on a Acme struct (highly recommended)

@WildEgo
Copy link
Author

WildEgo commented Sep 20, 2021

Yes, that's possible!

You can just use the gorm plugin https://github.com/go-gorm/dbresolver or multiple db instances on a Acme struct

Thank you for the quick reply, I've looked a bit into DBResolver and it looked like it couldn't really do it since I got the data in the runtime, I've never tried that last one could you send me a couple of links? I was trying at the moment by running the connect function again but it got overwritten at the time it got to the resolver

@loeffel-io
Copy link
Member

I am currently at vacation! I will update the demo on next Monday because multiple people got stuck at this point

@WildEgo
Copy link
Author

WildEgo commented Sep 20, 2021

I am currently at vacation! I will update the demo on next Monday because multiple people got stuck at this point

Thank you mate I didn't know, take ur time and enjoy ur vacation, thank u for this library, I've been going thru it and learning more GO thanks to it, truly appreciate ur work

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

2 participants