Daiki Nakashita
May 11, 2021

glad you asked that! All the repositories are packed up in a struct and passed into InitControllers in controllers.go. You can then pick and choose which repositories to inject into each controller. If you look at the InitController function in usercontroller.go, it only has access to UserRepo since it's the only repository passed into it. This way you can re-use the repositories in different controllers, and the controllers will be agnostic with regard to the implementation of each repository. (Maybe I should rename the repositories to services or something...idk lol)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Daiki Nakashita
Daiki Nakashita

Written by Daiki Nakashita

UC San Diego grad, working as a software developer in a foreign land while struggling to get a grasp of the culture and language.

No responses yet

Write a response