add proto buf

This commit is contained in:
devad 2022-03-29 20:04:17 +08:00
parent 22091c4cb0
commit 58865b6bab
5 changed files with 65 additions and 10 deletions

22
go.mod
View File

@ -16,7 +16,8 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch v0.0.0-20190203023257-5858425f7550 // indirect
github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415 // indirect
github.com/golang/protobuf v1.2.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf // indirect
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d // indirect
github.com/imdario/mergo v0.3.5 // indirect
@ -26,18 +27,19 @@ require (
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/smartystreets/goconvey v1.7.2 // indirect
github.com/spf13/pflag v1.0.1 // indirect
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 // indirect
golang.org/x/net v0.0.0-20190311183353-d8887717615a // indirect
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a // indirect
golang.org/x/sys v0.0.0-20190312061237-fead79001313 // indirect
golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db // indirect
golang.org/x/time v0.0.0-20161028155119-f51c12702a4d // indirect
google.golang.org/appengine v1.5.0 // indirect
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/inf.v0 v0.9.0 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/klog v0.3.1 // indirect
k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30 // indirect
k8s.io/utils v0.0.0-20190221042446-c2654d5206da // indirect
sigs.k8s.io/yaml v1.1.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

6
lan_trans/buf.gen.yaml Normal file
View File

@ -0,0 +1,6 @@
version: v1
plugins:
- name: cpp
out: gen/proto/cpp
- name: java
out: gen/proto/java

12
lan_trans/idl/buf.yaml Normal file
View File

@ -0,0 +1,12 @@
version: v1
breaking:
use:
- FILE
lint:
use:
- DEFAULT
# ignore:
# - google/type/datetime.proto
deps:
- buf.build/googleapis/googleapis
- buf.build/grpc-ecosystem/grpc-gateway

View File

@ -0,0 +1,35 @@
syntax = "proto3";
package demo;
option go_package = "gitlink.org.cn/JCCE/PCM/lan_trans/gen/proto/demo";
import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
enum OurTeam {
// github: devad
devad = 0;
}
message StringMessage { string value = 1; }
//
service DemoService {
// Echo
rpc Echo(StringMessage) returns (StringMessage) {
option (google.api.http) = {
post : "/apis/demo"
body : "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
deprecated : true // For testing purposes.
external_docs : {
url : "https://github.com/grpc-ecosystem/grpc-gateway"
description : "Find out more about the interface"
}
security : {}
};
}
}