solrac97gr / go-jwt-auth

Template create for use as CookieCutter for my Golang projects, I decided to create a template with everything already working. 🚀
94 stars 15 forks source link

[FEAT]: Restructure as per the Repository pattern #7

Open suntong opened 1 year ago

suntong commented 1 year ago

Description

As per The Repository Pattern

Keeping logic of your application along with your database logic makes your application much more complex, hard to test, and maintain.

There is already a proven and simple pattern that solves these issues. The pattern that allows you to separate your application logic from database logic. It allows you to make your code simpler and easier to add new functionalities.

This is not just another article with random code snippets. This post is part of a bigger series where we show how to build Go applications that are easy to develop, maintain, and fun to work with in the long term. We are doing it by sharing proven techniques based on many experiments we did with teams we lead and scientific research.

So it is better to move the database logic out of repositories layer into adapters, like in the trainer example.

Additional Information

No response