YouChuKoffee/rpc/user/user.proto

27 lines
620 B
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 文件位置pbfile/studnet.proto
// 指定使用的语法格式根据自己下载的protoc的版本选择
syntax = "proto3";
// 指定代码生成在哪个位置
option go_package = "./";
// 指定包名
package user;
message User{
string name = 1;
int32 age = 2;
}
// 定义请求体结构
message UserRequest{
int32 number = 1; //请求中传入学生的学号1表示占位符
}
// 定义响应体结构
message UserResponse{
User student = 1;
}
//定义一个服务,根据学生的学号查询学生的信息
service UserService{
rpc GetUserByStuNumber(UserRequest) returns (UserResponse);
}