Multiple databases support #62
Answered
by
benbjohnson
deividaspetraitis
asked this question in
Q&A
|
Hello Ben, Thanks for sharing these great resources! Would it be good approach inject DB/API service handler into UserService ? Thank you, Deividas |
Answered by
benbjohnson
Dec 9, 2021
Replies: 1 comment 1 reply
|
Hi @deividaspetraitis. If the package sqlite
type UserService struct {
AuthService myapp.AuthService
}Then I'd attach the concrete implementation in the |
1 reply
Answer selected by
benbjohnson
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @deividaspetraitis. If the
sqlite.UserServiceneeded to interact with anAuthServicethen I'd probably attach it as a field onsqlite.UserService:Then I'd attach the concrete implementation in the
cmd/myapp/main.goso that the sqlite implementation wouldn't need to know anything about the other database implementation.