...

Text file src/cloud.google.com/go/bigquery/storage/managedwriter/testdata/messages_proto2.proto

Documentation: cloud.google.com/go/bigquery/storage/managedwriter/testdata

     1// Copyright 2021 Google LLC
     2//
     3// Licensed under the Apache License, Version 2.0 (the "License");
     4// you may not use this file except in compliance with the License.
     5// You may obtain a copy of the License at
     6//
     7//     https://www.apache.org/licenses/LICENSE-2.0
     8//
     9// Unless required by applicable law or agreed to in writing, software
    10// distributed under the License is distributed on an "AS IS" BASIS,
    11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12// See the License for the specific language governing permissions and
    13// limitations under the License.
    14
    15syntax = "proto2";
    16package testdata;
    17option go_package = "cloud.google.com/go/bigquery/storage/managedwriter/testdata";
    18
    19
    20// SimpleMessage represents a simple message that transmits a string and int64 value.
    21message SimpleMessageProto2 {
    22    // name is a simple scalar string.
    23    optional string name = 1;
    24
    25    // value is a simple int64 value.
    26    optional int64 value = 2;
    27}
    28
    29message SimpleMessageEvolvedProto2 {
    30    // name is a simple scalar string.
    31    optional string name = 1;
    32
    33    // value is a simple int64 value.
    34    optional int64 value = 2;
    35    
    36    // other is an additional string.
    37    optional string other = 3;
    38}
    39
    40// OutOfOrderDefinitionProto2 is used to ensure we apply ordering to representations.
    41// It intentionally defines the fields out of order.
    42message OutOfOrderDefinitionProto2 {
    43
    44    enum OutOfOrderEnum {
    45        E1 = 1;
    46        E3 = 3;
    47        E2 = 2;
    48    }
    49
    50    optional string s3 = 3;
    51    optional string s1 = 1;
    52    optional string s2 = 2;
    53    optional OutOfOrderEnum enum2 = 5;
    54    optional OutOfOrderEnum enum1 = 4;
    55    optional SimpleMessageProto2 msg7 = 7;
    56    optional SimpleMessageProto2 msg6 = 6;
    57}
    58
    59message GithubArchiveEntityProto2 {
    60    optional int64 id = 1;
    61    optional string login = 2;
    62    optional string gravatar_id = 3;
    63    optional string avatar_url = 4;
    64    optional string url = 5;
    65}
    66
    67message GithubArchiveRepoProto2 {
    68    optional int64 id = 1;
    69    optional string name = 2;
    70    optional string url = 3;
    71}
    72
    73// GithubArchiveMessageProto2 is the proto2 version of github archive row.
    74message GithubArchiveMessageProto2 {
    75    optional string type = 1;
    76    optional bool public = 2;
    77    optional string payload = 3;
    78    optional GithubArchiveRepoProto2 repo = 4;
    79    optional GithubArchiveEntityProto2 actor = 5;
    80    optional GithubArchiveEntityProto2 org = 6;
    81    optional int64 created_at = 7;
    82    optional string id = 8;
    83    optional string other = 9;
    84}
    85
    86// ExtEnum is an externally define enum.
    87enum ExtEnum {
    88    UNDEFINED = 0;
    89    THING = 1;
    90    OTHER_THING = 2;
    91}
    92
    93// ExternalEnumMessage demonstrates an externally defined enum
    94// being present in two different submessages.
    95message ExternalEnumMessage {
    96    optional EnumMsgA msg_a = 1;
    97    optional EnumMsgB msg_b = 2;
    98}
    99
   100message EnumMsgA {
   101    optional string foo = 1;
   102    optional ExtEnum bar = 2;
   103}
   104
   105message EnumMsgB {
   106    optional ExtEnum baz = 1;
   107}
   108

View as plain text