feat: 提交资源
This commit is contained in:
7
protos/pkg1.bar.proto
Normal file
7
protos/pkg1.bar.proto
Normal file
@@ -0,0 +1,7 @@
|
||||
package pkg1;
|
||||
syntax = "proto3";
|
||||
|
||||
message Bar {
|
||||
// In proto3, fields are optional by default; 'required' is not allowed
|
||||
int32 bar = 1;
|
||||
}
|
||||
18
protos/pkg1.common.proto
Normal file
18
protos/pkg1.common.proto
Normal file
@@ -0,0 +1,18 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pkg1;
|
||||
|
||||
// 通用协议码定义,稳定标识每种业务消息类型
|
||||
enum MessageCode {
|
||||
MSG_UNKNOWN = 0;
|
||||
// 用户相关
|
||||
MSG_USER = 1001;
|
||||
// 示例:Bar 消息
|
||||
MSG_BAR = 1002;
|
||||
}
|
||||
|
||||
// 统一的包裹消息,承载协议码与具体消息的二进制负载
|
||||
message Envelope {
|
||||
int32 code = 1; // 对应 MessageCode
|
||||
bytes payload = 2; // 具体消息 encode 后的字节
|
||||
}
|
||||
10
protos/pkg1.user.proto
Normal file
10
protos/pkg1.user.proto
Normal file
@@ -0,0 +1,10 @@
|
||||
package pkg1;
|
||||
syntax = "proto3";
|
||||
|
||||
message User {
|
||||
int32 id = 1;
|
||||
string name = 2;
|
||||
int32 age = 3;
|
||||
repeated string emails = 4;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user