protobuf:使用import导入其它proto文件中定义的消息

一、db.proto

syntax = "proto3";

option java_multiple_files = true;
option java_package = "com.ub";

option objc_class_prefix = "TEST";




message DbRecord {
  string table =1;
  optional string dataColumn01 =2;
  optional string dataColumn02 =3;
  optional string dataColumn03 =4;
  optional string dataColumn04 =5;
  optional string dataColumn05 =6;
  optional string dataColumn06 =7;
  optional string dataColumn07 =8;
  optional string dataColumn08 =9;
  optional string dataColumn09 =10;
  optional string dataColumn10 =11;
  optional string dataColumn11 =12;
  optional string dataColumn12 =13;
  optional string dataColumn13 =14;
  optional string dataColumn14 =15;
  optional string dataColumn15 =16;
  optional string dataColumn16 =17;
  optional string dataColumn17 =18;
  optional string dataColumn18 =19;
  optional string dataColumn19 =20;
  optional string dataColumn20 =21;

}
message DbResponse {
  string table =1;
  string message =2;
}

service DbService {
  rpc insertData(stream DbRecord) returns (stream DbResponse);
}


二、test.proto

syntax = "proto3";
import "db.proto";
option java_multiple_files = true;
option java_package = "com.ub";

option objc_class_prefix = "TEST";
message NewRecord {
  DbRecord db=1;
}


你可能感兴趣的:(JAVA基础,java,数据库,服务器)