.proto 文件中 "Value" class 的含义是什么

what is the meaning of "Value" class in .proto file

谁能解释一下下面 .proto 文件中 "Value" 的含义?

message Test {
string id = 1;
string name = 2;
google.protobuf.Value property = 6;}

没有 import 它可能不应该工作,但是:它代表一个灵活类型的值; Value "well known type" 本质上是几种常见类型的联合 (oneof),其中 Java API(来自您的标签)described here .

定义在struct.proto中(因此你需要import "google/protobuf/struct.proto";),或者基本上:

message Value {
  // The kind of value.
  oneof kind {
    // Represents a null value.
    NullValue null_value = 1;
    // Represents a double value.
    double number_value = 2;
    // Represents a string value.
    string string_value = 3;
    // Represents a boolean value.
    bool bool_value = 4;
    // Represents a structured value.
    Struct struct_value = 5;
    // Represents a repeated `Value`.
    ListValue list_value = 6;
  }
}