bxcodec / go-clean-arch

Go (Golang) Clean Architecture based on Reading Uncle Bob's Clean Architecture
MIT License
9.03k stars 1.19k forks source link

Cyclic Dependence #78

Closed Koichi-hub closed 1 year ago

Koichi-hub commented 1 year ago

The code contains a dependency of the database component on the controller component

// We taken ctx from request in controller
ctx := c.Request().Context()

// And controller hand it to usercase
func (a *articleUsecase) fillAuthorDetails(c context.Context, data []domain.Article) ([]domain.Article, error)

// And usercase hand it to repository
func (m *mysqlAuthorRepo) GetByID(ctx context.Context, id int64) (domain.Author, error)

If I would like to use library like a GORM I would need to edit 3 components For the rest, I would like to note that this is so far the best implementation of pure architecture on golang that I know.