Go Clean Architecture with transaction
- Clean architecture
- Clean transaction
go generate ./...
go test ./...
go run ./cmd/http
Source: MyTaskPanel Consulting
.
├── cmd # Main applications
├── internal # Private application and library code
├── pkg # Library code that's ok to use by external applications
├── go.mod
├── go.sum
├── LICENSE
└── README.md
.
├── ...
├── internal
│ ├── domain # Domain: entity, data model
│ ├── port # Port: interface for communicating between layers
│ │ └── mock
│ ├── infrastructure # External elements with which the application communicates, both input and output
│ │ ├── http # Entry point: an API with REST or GraphQL, messaging with RabbitMQ or via CLI, etc.
│ │ │ ├── gin
│ │ │ └── presenter
│ │ └── repo # Exit point: a database with PostgreSQL, MongoDB, or sending messages with RabbitMQ, etc.
│ │ ├── memory
│ │ └── database
│ └── usecase # Business logic happens here
└── ...