Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hobord/clean-go
https://github.com/hobord/clean-go
Last synced: 27 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/hobord/clean-go
- Owner: hobord
- Created: 2022-06-08T12:59:20.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-06-15T06:12:45.000Z (over 2 years ago)
- Last Synced: 2024-06-20T21:11:07.274Z (8 months ago)
- Language: Dockerfile
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Go app structure
--```
/app // global application level singletons like log, build infos, config etc..
/cmd // commandline application entry point, app starts here
/delivery // contains all delivery implementations
/httpd // http delirvery implementation
/dto // dto contract for our http server
/handlers
/middlewares
/protobuf // proto files
/protogo // go lang generated from proto
/entity // domain entities (like customer, org, invoice)
/pkg // generic shared packages, utilities (converters, operators) You can make separate repository for that
/repository // repositories interfaces and mocks
/impl // repositories implementations by infrastructures
/firebase // firebase implementations of repositories
/customer // an example customer repository implementation
/redis
/apiclientxx // client implementation to some specific api
/dto // dto for api
/postgres
/migrations // database schema management
/services // services, business logic, stories
/customer
```- To generate mocks use https://github.com/vektra/mockery/
Use ```//go:generate mockery --name InterfaceName``` to generate mocks with
```go generate command```- Use https://github.com/golang-migrate tool to manage changes on db schema
- I recommend to look at https://github.com/hobord/go-modules (logger, worker
etc..)- Do not use directly log implementation, use Log interface
Use CorrelationID and TraceID in logs to track process flows accross all services.
Its good to see the file name and line number when You make logs.
Its nice to know about version and githash in the logs.