- Package structure
- Define Primary Ports, Secondary Ports
- Define Models & Data Structure
- Proto Contract
- Generate Proto File
- Define Ports & Models
- Implement Primary & Secondary Adapter
- Implement Core Business Logic
- Testing
- Di repo ini, menggunakan libprotoc 26.1, untuk cek versi protoc yang terinstall bisa menggunakan command berikut
protoc --version
- Definisikan spec proto di folder
lib/protos/v1/xxxx/xxx.proto
- Misal untuk wallet di
lib/protos/v1/wallet/wallet.proto
- Lalu jalankan command berikut
protoc -I . --proto_path=. \ --go_out=paths=source_relative:. \ --go-http_out=paths=source_relative:. \ --go-grpc_out=paths=source_relative:. \ --openapiv2_out ./lib/protos/openapiv2 --openapiv2_opt logtostderr=true \ ./lib/protos/v1/wallet/wallet.proto
- File *.go akan tergenerate sesuai lokasi folder proto yang kita define, dan akan melakukan generate ke spec open API di folder
lib/protos/openapiv2/lib/protos/v1/wallet/wallet.swagger.json
- Isi dari makefile, pada dasarnya merupakan command di atas yang lebih di rapikan
- Untuk generate melalui makefile, misal untuk proto wallet yang ada di folder
lib/protos/v1/wallet/wallet.proto
bisa menggunakan command berikutMODULE=v1/wallet make generate
- Untuk generate file go di semua proto, bisa langsung jalankan command berikut
make generate