使用gRPC构建一个简易的商品服务注册到etcd中 创建models/protos目录,新建商品模型 1syntax = "proto3";2package models;34// 商品模型 5message ProdModel{6 // @inject_tag: json:"pid" 7 int32 ProdId = 1;8 // @inject_tag: json:"pname" 9 string ProdName = 2;10}使用protoc创建服务 1syntax = "proto3";2package models;34import "models.proto";56message ProdRequest{7 int32 size = 1;8}910message ProdListResponse{11 repeated ProdModel data = 1;12}1314service ProdService{15 rpc GetProdList(ProdRequest) returns (ProdListResponse);16}使用proto……

阅读全文