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

V2 #8

Merged
merged 5 commits into from
Apr 30, 2018
Merged

V2 #8

merged 5 commits into from
Apr 30, 2018

Conversation

bxcodec
Copy link
Owner

@bxcodec bxcodec commented Apr 30, 2018

Proposed Changes:

  • New Project Structure
  • Move to Godep

Close #7

@bxcodec
Copy link
Owner Author

bxcodec commented Apr 30, 2018

There will be a new packages called: models

models
├── article.go
├── author.go
└── errors.go

This package models, will store any models used in entire projects

Domain Package

And for each domain, will have the other layer like : repository, usecase and delivery.
And moving the interface to the root of domain.
This how it looks now:

Article Domain

article
├── delivery
│   └── http
│       ├── article_handler.go
│       └── article_test.go
├── mocks
│   ├── ArticleRepository.go
│   └── ArticleUsecase.go
├── repository //Encapsulated Implementation of Repository Interface
│   ├── mysql_article.go
│   └── mysqlarticle_test.go
├── repository.go // Repository Interface
├── usecase //Encapsulated Implementation of Usecase Interface
│   ├── articleucase_test.go
│   └── artilce_ucase.go
└── usecase.go // Usecase Interface.

My reason making this structure are:

  • Avoiding the cyclic import
  • Restoring the golang identity as a programming language that using package system, the article domain, become a package that only provides interface function to outside(article/usecase.go and article/repository.go), without displaying the implementations.

For some people this arch, will not solve their problem, so make sure to search others do, that may be fit to your problem.

@bxcodec bxcodec merged commit b50f0fb into master Apr 30, 2018
@bxcodec bxcodec deleted the v2 branch April 30, 2018 04:10
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

Successfully merging this pull request may close these issues.

None yet

1 participant