摘要:        
定义Models.proto syntax = "proto3"; package services; import "google/protobuf/timestamp.proto"; //引入timestamp的proto文件 //商品模型 message ProdModel { int32 p    阅读全文
posted @ 2019-12-19 21:53
离地最远的星
阅读(168)
评论(0)
推荐(0)
        
            
        
        
摘要:        
使用第三方库protoc-gen-validate,validate.proto是我从下载的库里面复制出来的,可以直接指定目录,我为了避免麻烦直接拷贝出来了 syntax = "proto3"; package services; import "google/protobuf/timestamp.    阅读全文
posted @ 2019-12-19 21:32
离地最远的星
阅读(1806)
评论(0)
推荐(0)
        
            
        
        
摘要:        
package main import ( "context" "fmt" "google.golang.org/grpc" "google.golang.org/grpc/credentials" "grpccli/services" "log" ) func main() { creds, er    阅读全文
posted @ 2019-12-19 21:30
离地最远的星
阅读(123)
评论(0)
推荐(0)
        
            
        
        
摘要:        
使用枚举、获取分区商品库存 syntax = "proto3"; package services; import "google/api/annotations.proto"; message ProdRequest { int32 prod_id = 1; //传入id } message Pr    阅读全文
posted @ 2019-12-19 21:30
离地最远的星
阅读(195)
评论(0)
推荐(0)
        
            
        
        
摘要:        
package main import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials" "grpcpro/services" "log" "net" ) func main() { creds, err := crede    阅读全文
posted @ 2019-12-19 21:28
离地最远的星
阅读(154)
评论(0)
推荐(0)
        
            
        
        
摘要:        
服务端代码 package main import ( "crypto/tls" "crypto/x509" "google.golang.org/grpc" "google.golang.org/grpc/credentials" "grpcpro/services" "io/ioutil" "n    阅读全文
posted @ 2019-12-19 21:24
离地最远的星
阅读(1944)
评论(0)
推荐(0)
        
            
        
        
摘要:        
syntax = "proto3"; package services; import "Models.proto"; message UserScoreRequest { repeated UserInfo users = 1; } message UserScoreResponse { repe    阅读全文
posted @ 2019-12-19 21:21
离地最远的星
阅读(306)
评论(0)
推荐(0)
        
            
        
        
摘要:        
下载go get -v github.com/grpc-ecosystem/grpc-gateway,然后把这个包下面的third-party下面的google文件夹拷贝到Prod.proto的同级目录下 syntax = "proto3"; package services; import "go    阅读全文
posted @ 2019-12-19 21:20
离地最远的星
阅读(1141)
评论(0)
推荐(0)
        
            
        
        
摘要:        
重新编写proto文件 syntax = "proto3"; package services; import "google/api/annotations.proto"; message ProdRequest { int32 prod_id = 1; //传入id } message Prod    阅读全文
posted @ 2019-12-19 21:17
离地最远的星
阅读(1845)
评论(0)
推荐(0)
        
            
        
        
摘要:        
package main import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials" "grpcpro/services" "log" "net/http" ) func main() { creds, err :=     阅读全文
posted @ 2019-12-19 21:16
离地最远的星
阅读(1415)
评论(0)
推荐(0)
        
 
                    
                
 浙公网安备 33010602011771号
浙公网安备 33010602011771号