Generate GoFrame business via proto file
- protoc-gen-gf-api for api
- protoc-gen-gf-controller for controller
- protoc-gen-gf-logic for logic
- protoc-gen-gf-model for model
- protoc-gen-gf-client for client
- Generate the
proto
file by mysql-to-proto - Adjust the
services
andmessages
in theproto
, please don't use thePATCH
method, the generator will generateCRUD
for it - Generate the
CRUD
byprotoc-gen-gf
- Copy the
files
to thepackage
you want to place - Adjust the fields of
Req
andRes
in theapi
- Adjust the fields of
Input
andOutput
in themodel
- Adjust the functions in the
logic
- Initialize your
DB
andNoSQL
in thecmd
- Initialize your
logic
in thecmd
- Initialize your
controller
in thecmd
Run
andTest
- Create directory
google
in$GOPATH/src
- Copy
google/api
in googleapis to$GOPATH/src/google
- Copy
src/google/protobuf
in protobuf to$GOPATH/src/google
- Now, it has
api
andprotobuf
in$GOPATH/src/google
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && \
go install github.com/zcyc/protoc-gen-gf/protoc-gen-gf-api@main \
github.com/zcyc/protoc-gen-gf/protoc-gen-gf-controller@main \
github.com/zcyc/protoc-gen-gf/protoc-gen-gf-logic@main \
github.com/zcyc/protoc-gen-gf/protoc-gen-gf-model@main \
github.com/zcyc/protoc-gen-gf/protoc-gen-gf-client@main
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && `
go install github.com/zcyc/protoc-gen-gf/protoc-gen-gf-api@main `
github.com/zcyc/protoc-gen-gf/protoc-gen-gf-controller@main `
github.com/zcyc/protoc-gen-gf/protoc-gen-gf-logic@main `
github.com/zcyc/protoc-gen-gf/protoc-gen-gf-model@main `
github.com/zcyc/protoc-gen-gf/protoc-gen-gf-client@main
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && ^
go install github.com/zcyc/protoc-gen-gf/protoc-gen-gf-api@main ^
github.com/zcyc/protoc-gen-gf/protoc-gen-gf-controller@main ^
github.com/zcyc/protoc-gen-gf/protoc-gen-gf-logic@main ^
github.com/zcyc/protoc-gen-gf/protoc-gen-gf-model@main ^
github.com/zcyc/protoc-gen-gf/protoc-gen-gf-client@main
protoc -I ./api -I $GOPATH/src \
--go_out ./api --go_opt=paths=source_relative \
--gf-api_out ./api --gf-api_opt=paths=source_relative \
--gf-controller_out ./api --gf-controller_opt=paths=source_relative \
--gf-logic_out ./api --gf-logic_opt=paths=source_relative \
--gf-model_out ./api --gf-model_opt=paths=source_relative \
--gf-client_out ./api --gf-client_opt=paths=source_relative \
./api/v1/article.proto
protoc -I ./api -I $env:GOPATH/src `
--go_out ./api --go_opt=paths=source_relative `
--gf-api_out ./api --gf-api_opt=paths=source_relative `
--gf-controller_out ./api --gf-controller_opt=paths=source_relative `
--gf-logic_out ./api --gf-logic_opt=paths=source_relative `
--gf-model_out ./api --gf-model_opt=paths=source_relative `
--gf-client_out ./api --gf-client_opt=paths=source_relative `
./api/v1/article.proto
protoc -I ./api -I %GOPATH%/src ^
--go_out ./api --go_opt=paths=source_relative ^
--gf-api_out ./api --gf-api_opt=paths=source_relative ^
--gf-controller_out ./api --gf-controller_opt=paths=source_relative ^
--gf-logic_out ./api --gf-logic_opt=paths=source_relative ^
--gf-model_out ./api --gf-model_opt=paths=source_relative ^
--gf-client_out ./api --gf-client_opt=paths=source_relative ^
./api/v1/article.proto