摘要:
定义Models.proto syntax = "proto3"; package services; import "google/protobuf/timestamp.proto"; //引入timestamp的proto文件 //商品模型 message ProdModel { int32 p 阅读全文
摘要:
使用第三方库protoc-gen-validate,validate.proto是我从下载的库里面复制出来的,可以直接指定目录,我为了避免麻烦直接拷贝出来了 syntax = "proto3"; package services; import "google/protobuf/timestamp. 阅读全文
摘要:
package main import ( "context" "fmt" "google.golang.org/grpc" "google.golang.org/grpc/credentials" "grpccli/services" "log" ) func main() { creds, er 阅读全文
摘要:
使用枚举、获取分区商品库存 syntax = "proto3"; package services; import "google/api/annotations.proto"; message ProdRequest { int32 prod_id = 1; //传入id } message Pr 阅读全文
摘要:
package main import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials" "grpcpro/services" "log" "net" ) func main() { creds, err := crede 阅读全文
摘要:
服务端代码 package main import ( "crypto/tls" "crypto/x509" "google.golang.org/grpc" "google.golang.org/grpc/credentials" "grpcpro/services" "io/ioutil" "n 阅读全文
摘要:
syntax = "proto3"; package services; import "Models.proto"; message UserScoreRequest { repeated UserInfo users = 1; } message UserScoreResponse { repe 阅读全文
摘要:
下载go get -v github.com/grpc-ecosystem/grpc-gateway,然后把这个包下面的third-party下面的google文件夹拷贝到Prod.proto的同级目录下 syntax = "proto3"; package services; import "go 阅读全文
摘要:
重新编写proto文件 syntax = "proto3"; package services; import "google/api/annotations.proto"; message ProdRequest { int32 prod_id = 1; //传入id } message Prod 阅读全文
摘要:
package main import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials" "grpcpro/services" "log" "net/http" ) func main() { creds, err := 阅读全文