simple project - implement api service by golang
- Support Jaeger
- MongoDB
- Unit Test & Integration Test (DB)
- Logstash to ElasticSearch
- Implement Application, Service, Repository, domain Layer
- run debug mode
- Kubenetes Deployment
- Gitlab CI
/app # application layer
/inout # api input / output
/company
company.go
craeteCompany.go # create company input / output
app.go # setup api handlers
createCompany.go # api
createCompany_test.go # api testing
/config # load config (from env)
config.go
/deployment # kubernetes config for deploy
/development # development tools (db, jaeger, local env)
docker-compose.yml # docker mongodb, elasticsearch + kibana, jaeger
local.env # local env for integration test
/domain # business logic layer
/company
company.go
company_test.go
/external # external service layer
/lib # internal library
/repository # repository layer
/company
/mocks # repository mocks for testing
/store # repository implement interface
repository.go # repository interface & repository errors
/service # service layer for control domains
/company
/withtracer # implement jaeger trace by wrap service interface
/mocks # mock service for testing
create.go
main.go # initial application
setup.go # load and setup dependency
Mockery
GO111MODULE=off go get github.com/vektra/mockery/.../
git clone https://github.com/devit-tel/gogo-blueprint.git
cd gogo-blueprint
go mod download
unit testing command
go test ./...
integrating testing command
go test ./... -tags integration
generate mocks from interfaces for unit testing
go generate ./...
development in local start mongodb, elasticsearch + kibana, jaeger
cd development
source ./local.env
docker-compose up -d
please see in the example code implement jaeger wrap service service/company/withtracer