luksrocha / golang-basic-crud

Basic Golang CRUD system for study

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adjusting the domain

rluders opened this issue · comments

Use cases are part of the domain! Yes... Really... consider the domain the "pure abstraction" of your logic, everything that doesn't actually depend on any other layer of your application. So, I'll probably even say that the repository interface should be part of your domain, 'cause it is the "contract that that domain has with the outside world".

This is a good article about this subject: https://proandroiddev.com/clean-architecture-data-flow-dependency-rule-615ffdd79e29

So, my advice is to:

  • Create a repository interface per entity inside the domain. (House entity must have an interface to HouseRepository) - basically, you will have to move this to the domain.
  • Move your use cases to the domain. Remember that now, you will have to also adjust this to use the interface (SOLID ftw)

For now, this should be enough (but there are more adjusts, try to figure out by yourself)