Demo entry 1469057

Protobuf example from highlight.js

   

Submitted by anonymous on Mar 16, 2015 at 14:20
Language: Protocol Buffer. Code size: 621 Bytes.

package languages.protobuf;

option java_package = "org.highlightjs.languages.protobuf";

message Customer {
  required int64 customer_id = 1;
  optional string name = 2;
  optional string real_name = 3 [default = "Anonymous"];
  optional Gender gender = 4;
  repeated string email_addresses = 5;

  optional bool is_admin = 6 [default = false]; // or should this be a repeated field in Account?

  enum Gender {
    MALE = 1,
    FEMALE = 2
  }
}

service CustomerSearch {
  rpc FirstMatch(CustomerRequest) returns (CustomerResponse);
  rpc AllMatches(CustomerRequest) returns (CustomerResponse);
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).