46 lines
885 B
Protocol Buffer
Raw Permalink Normal View History

2025-08-24 11:35:52 +08:00
syntax = "proto3";
package hello;
option go_package="122.51.31.227/go-course/go18/skills/rpc/protobuf/hello_service";
2025-08-24 15:58:47 +08:00
// 这里是应用其他的proto文件, 后面会讲 ipmort用法
import "google/protobuf/any.proto";
2025-08-24 11:35:52 +08:00
// The HelloService service definition.
service HelloService {
// rpc 声明接口
rpc Hello (Request) returns (Response);
2025-08-24 14:34:22 +08:00
rpc Channel (stream Request) returns (stream Response) {}
2025-08-24 11:35:52 +08:00
}
message Request {
string value = 1;
2025-08-24 15:58:47 +08:00
// map
map<string, string> extras = 2;
}
message RequestSet {
int64 total = 1;
// repeated 来描述一个数组
repeated Request items = 2;
2025-08-24 11:35:52 +08:00
}
message Response {
string value = 1;
2025-08-24 15:58:47 +08:00
}
enum Corpus {
UNIVERSAL = 0;
WEB = 1;
IMAGES = 2;
LOCAL = 3;
NEWS = 4;
PRODUCTS = 5;
VIDEO = 6;
}
message ErrorStatus {
string message = 1;
repeated google.protobuf.Any details = 2;
2025-08-24 11:35:52 +08:00
}