Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about directory layer #69

Open
ben-swit opened this issue Oct 28, 2022 · 1 comment
Open

Question about directory layer #69

ben-swit opened this issue Oct 28, 2022 · 1 comment

Comments

@ben-swit
Copy link

ben-swit commented Oct 28, 2022

hi @bxcodec thank for your source

i got a lot of help

I want to know why I classified each directory under the domain.

like

article
├── delivery
│   └── http
│       ├── article_handler.go
│       ├── article_test.go
│       └── middleware
│           ├── middleware.go
│           └── middleware_test.go
├── repository
│   ├── helper.go
│   └── mysql
│       ├── mysql_article.go
│       └── mysqlarticle_test.go
└── usecase
    ├── article_ucase.go
    └── article_ucase_test.go

to

article
├── article_handler.go
├── article_test.go
├── article_ucase.go
├── article_ucase_test.go
├── mysql_article.go
└── mysqlarticle_test.go

why i think this needs, when developing have to open many folders

and this sample usefull msa?

@Ajilagi
Copy link

Ajilagi commented Oct 28, 2022

I agree with your thought @ben-swit. I prefer to put all of them into one package, so we only need article package, and it's easier to use article.NewHandler(), article.NewUsecase(), article.NewRepo(), and anything about article instead of using each of handler, usecase, etc. It also prevents nested packaging and aliasing like the one in below

_articleHttpDelivery "github.com/bxcodec/go-clean-arch/article/delivery/http"
_articleHttpDeliveryMiddleware "github.com/bxcodec/go-clean-arch/article/delivery/http/middleware"
_articleRepo "github.com/bxcodec/go-clean-arch/article/repository/mysql"
_articleUcase "github.com/bxcodec/go-clean-arch/article/usecase"
_authorRepo "github.com/bxcodec/go-clean-arch/author/repository/mysql"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants