You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the great project btw.
It is really nice and neat structure, and I'm really enjoying develop project with this architecture.
How would you go about putting some depth on domain directories like below?
Because one domain may have so much of data types and if all that data types exists in just one file (black_ipv4.go in v3 clean-arch), it would be really hard to read the code and would be very fat.
black_ipv4
- delivery
- http
- black_ipv4_handler.go
- repository
- black_ipv4_repo.go
- usecase
- black_ipv4_usecase.go
- repository.go
- usecase.go
domain
- black_ipv4
- model
- attack_vector.go // Attack vector is a core data type indicating the type of attack the black ipv4. was attacking one of our customer's domain.
- report.go // Report is a data type summarizing the most dangerous black ipv4 in specific period.
- reputation.go // Reputation of black ipv4 during whole period.
- custom_error
- auth.go // Handles error raising during authentication process. To use this API, user must issue api key.
- server.go // Handles error raising because of server fault which have status code 5xx mostly.
If we struct project like above example there are benefits:
You can import all data types which is used in a domain with just one import sentense: import "github.com/aeharvlee/black-ip-api/black_ipv4/model
You don't have to worry about one big domain file. You can freely add many data types for a domain.
Readability is now good. You can read domain directory like "Oh, black_ipv4 domain have three main data types. attack_vector, report, and reputation. So if I want to add some fields on attack vector, what I do is just add some fields in attack_vector.go
Actually I used version2 features: You can see repository.go and usecase.go in black_ipv4 directory. The reason I use this v2 feature is "Repository and Usecase should use for a domain and should not use for each data types of the domain." It don't make sense use repo for attack_vector under the domain/black_ipv4/attack_vector because what we target is "domain/black_ipv4" not a piece of the domain.
If you don't understand well or need specific examples, please feel free to tell me. I will make an appropriate example on GitHub.
Edit:
If you agree with me, I will edit the source code and proceed with the pull request. Thanks.
The reason I use model directory under the black_ipv4 is for using echo-swagger. echo-swagger confuses because if we don't have model directory, there are two black_ipv4 directories.
The text was updated successfully, but these errors were encountered:
aeharvlee
changed the title
Model directory under the domain directory
[enhancement Label] Model directory under the domain directory
May 26, 2020
aeharvlee
changed the title
[enhancement Label] Model directory under the domain directory
[enhancement] Model directory under the domain directory
May 26, 2020
Thanks for the great project btw.
It is really nice and neat structure, and I'm really enjoying develop project with this architecture.
How would you go about putting some depth on domain directories like below?
Because one domain may have so much of data types and if all that data types exists in just one file (black_ipv4.go in v3 clean-arch), it would be really hard to read the code and would be very fat.
If we struct project like above example there are benefits:
import "github.com/aeharvlee/black-ip-api/black_ipv4/model
attack_vector.go
Actually I used version2 features: You can see
repository.go
andusecase.go
inblack_ipv4
directory. The reason I use this v2 feature is "Repository and Usecase should use for a domain and should not use for each data types of the domain." It don't make sense use repo for attack_vector under thedomain/black_ipv4/attack_vector
because what we target is "domain/black_ipv4" not a piece of the domain.If you don't understand well or need specific examples, please feel free to tell me. I will make an appropriate example on GitHub.
Edit:
If you agree with me, I will edit the source code and proceed with the pull request. Thanks.
The reason I use
model
directory under theblack_ipv4
is for using echo-swagger. echo-swagger confuses because if we don't have model directory, there are twoblack_ipv4
directories.The text was updated successfully, but these errors were encountered: