mirror of
https://github.com/TECHNOFAB11/powerproto.git
synced 2025-12-12 16:10:03 +01:00
chore(*): update plugin default options && add examples
Signed-off-by: storyicon <yuanchao@bilibili.com>
This commit is contained in:
parent
bc28762992
commit
4f4006ee7d
18 changed files with 342 additions and 10 deletions
28
examples/using-gogofast/README.md
Normal file
28
examples/using-gogofast/README.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# Using GoGoFast
|
||||
|
||||
This example uses the following public libraries:
|
||||
* [googleapis](https://github.com/googleapis/googleapis)
|
||||
* [gogoproto](https://github.com/gogo/protobuf/tree/master/gogoproto)
|
||||
|
||||
The following plug-ins are used:
|
||||
* [protoc-gen-gofast](github.com/gogo/protobuf/protoc-gen-gofast)
|
||||
* [protoc-gen-grpc-gateway](github.com/grpc-ecosystem/grpc-gateway)
|
||||
|
||||
You can compile the proto file in this directory by executing the following command:
|
||||
```
|
||||
powerproto build -r ./apis
|
||||
```
|
||||
|
||||
Not surprisingly, you will get the following output:
|
||||
```
|
||||
➜ tree
|
||||
.
|
||||
├── README.md
|
||||
├── apis
|
||||
│ ├── service.pb.go
|
||||
│ ├── service.pb.gw.go
|
||||
│ └── service.proto
|
||||
└── powerproto.yaml
|
||||
|
||||
1 directory, 5 files
|
||||
```
|
||||
40
examples/using-gogofast/apis/service.proto
Normal file
40
examples/using-gogofast/apis/service.proto
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
syntax = "proto3";
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
package powerproto.examples.using_gogo;
|
||||
option go_package = "github.com/storyicon/powerproto/examples/using_gogo/apis;apis";
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_package = "com.powerproto.examples.using_gogo";
|
||||
option objc_class_prefix = "BAPIMetadata";
|
||||
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
option (gogoproto.goproto_registration) = true;
|
||||
|
||||
service Mocker {
|
||||
rpc Echo (EchoRequest) returns (EchoResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/echo"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
message EchoRequest {
|
||||
string message = 1;
|
||||
int64 timestamp = 2;
|
||||
uint32 code = 3;
|
||||
uint32 delay = 4;
|
||||
}
|
||||
|
||||
message EchoResponse {
|
||||
string message = 1;
|
||||
int64 timestamp = 2;
|
||||
string server = 3;
|
||||
}
|
||||
24
examples/using-gogofast/powerproto.yaml
Normal file
24
examples/using-gogofast/powerproto.yaml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
scopes:
|
||||
- ./
|
||||
protoc: v3.17.3
|
||||
protocWorkDir: ""
|
||||
plugins:
|
||||
protoc-gen-gofast: github.com/gogo/protobuf/protoc-gen-gofast@v1.3.2
|
||||
protoc-gen-grpc-gateway: github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@v2.5.0
|
||||
repositories:
|
||||
GOGO_PROTOBUF: https://github.com/gogo/protobuf@226206f39bd7276e88ec684ea0028c18ec2c91ae
|
||||
GOOGLE_APIS: https://github.com/googleapis/googleapis@75e9812478607db997376ccea247dd6928f70f45
|
||||
options:
|
||||
- --grpc-gateway_out=.
|
||||
- --grpc-gateway_opt=paths=source_relative
|
||||
- --gofast_out=plugins=grpc:.
|
||||
- --gofast_opt=paths=source_relative
|
||||
importPaths:
|
||||
- .
|
||||
- $GOPATH
|
||||
- $POWERPROTO_INCLUDE
|
||||
- $SOURCE_RELATIVE
|
||||
- $GOOGLE_APIS/github.com/googleapis/googleapis
|
||||
- $GOGO_PROTOBUF
|
||||
postActions: []
|
||||
postShell: ""
|
||||
Loading…
Add table
Add a link
Reference in a new issue