2025-02-16 17:30:04 +08:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package hello;
|
|
|
|
option go_package="gitlab.com/go-course-project/go17/skills/grpc/service";
|
|
|
|
|
|
|
|
message HelloRequest {
|
|
|
|
string my_name = 1;
|
|
|
|
int64 age = 2;
|
|
|
|
repeated int64 magic_number = 3;
|
|
|
|
map<string,string> extras = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
message HelloResponse {
|
|
|
|
string message = 1;
|
|
|
|
}
|
|
|
|
|
2025-02-16 18:13:10 +08:00
|
|
|
message ChatRequest {
|
|
|
|
uint64 id = 1;
|
|
|
|
string message = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ChatResponse {
|
|
|
|
uint64 id = 1;
|
|
|
|
bool is_success = 2;
|
|
|
|
string message = 3;
|
|
|
|
}
|
|
|
|
|
2025-02-16 17:30:04 +08:00
|
|
|
// grpc 接口声明
|
|
|
|
service HelloService {
|
|
|
|
rpc Hello(HelloRequest) returns(HelloResponse);
|
2025-02-16 18:13:10 +08:00
|
|
|
// 双向流接口
|
|
|
|
rpc Chat(stream ChatRequest) returns(stream ChatResponse);
|
2025-02-16 17:30:04 +08:00
|
|
|
}
|