Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

can someone please explain me the meaning of "Value" in below .proto file?

message Test {
string id = 1;
string name = 2;
google.protobuf.Value property = 6;}
like image 493
Ashlin Karkada Avatar asked Sep 16 '25 09:09

Ashlin Karkada


1 Answers

Without an import it probably shouldn't work, however: it represents a flexibly typed value; the Value "well known type" is essentially a union (oneof) of a few common types, with the Java API (from your tags) described here.

The definition is in struct.proto (hence you'll need import "google/protobuf/struct.proto";), or basically:

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;
  }
}
like image 79
Marc Gravell Avatar answered Sep 19 '25 07:09

Marc Gravell