github.com/gogo/protobuf@v1.3.2/test/types/combos/both/types.proto (about)

     1  // Protocol Buffers for Go with Gadgets
     2  //
     3  // Copyright (c) 2016, The GoGo Authors. All rights reserved.
     4  // http://github.com/gogo/protobuf
     5  //
     6  // Redistribution and use in source and binary forms, with or without
     7  // modification, are permitted provided that the following conditions are
     8  // met:
     9  //
    10  //     * Redistributions of source code must retain the above copyright
    11  // notice, this list of conditions and the following disclaimer.
    12  //     * Redistributions in binary form must reproduce the above
    13  // copyright notice, this list of conditions and the following disclaimer
    14  // in the documentation and/or other materials provided with the
    15  // distribution.
    16  //
    17  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    18  // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    19  // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    20  // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    21  // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    22  // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    23  // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    24  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    25  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    26  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    27  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    28  
    29  syntax = "proto3";
    30  
    31  package types;
    32  
    33  import "github.com/gogo/protobuf/gogoproto/gogo.proto";
    34  
    35  //import "google/protobuf/any.proto";
    36  import "google/protobuf/duration.proto";
    37  import "google/protobuf/struct.proto";
    38  import "google/protobuf/timestamp.proto";
    39  import "google/protobuf/wrappers.proto";
    40  
    41  option (gogoproto.testgen_all) = true;
    42  option (gogoproto.populate_all) = true;
    43  option (gogoproto.benchgen_all) = true;
    44  option (gogoproto.unmarshaler_all) = true;
    45  option (gogoproto.marshaler_all) = true;
    46  option (gogoproto.sizer_all) = true;
    47  option (gogoproto.equal_all) = true;
    48  option (gogoproto.verbose_equal_all) = true;
    49  option (gogoproto.unsafe_marshaler_all) = false;
    50  option (gogoproto.unsafe_unmarshaler_all) = false;
    51  
    52  message KnownTypes {
    53    option (gogoproto.compare) = true;
    54    google.protobuf.Duration dur = 1;
    55    google.protobuf.Timestamp ts = 2;
    56    google.protobuf.DoubleValue dbl = 3;
    57    google.protobuf.FloatValue flt = 4;
    58    google.protobuf.Int64Value i64 = 5;
    59    google.protobuf.UInt64Value u64 = 6;
    60    google.protobuf.Int32Value i32 = 7;
    61    google.protobuf.UInt32Value u32 = 8;
    62    google.protobuf.BoolValue bool = 9;
    63    google.protobuf.StringValue str = 10;
    64    google.protobuf.BytesValue bytes = 11;
    65  
    66    // TODO uncomment this once https://github.com/gogo/protobuf/issues/197 is fixed
    67    google.protobuf.Struct st = 12;
    68    // google.protobuf.Any an = 14;
    69  }
    70  
    71  message ProtoTypes {
    72    // TODO this should be a compare_all at the top of the file once time.Time, time.Duration, oneof and map is supported by compare
    73    option (gogoproto.compare) = true;
    74    google.protobuf.Timestamp nullableTimestamp = 1;
    75    google.protobuf.Duration nullableDuration = 2;
    76    google.protobuf.DoubleValue nullableDouble = 3;
    77    google.protobuf.FloatValue nullableFloat = 4;
    78    google.protobuf.Int64Value nullableInt64 = 5;
    79    google.protobuf.UInt64Value nullableUInt64 = 6;
    80    google.protobuf.Int32Value nullableInt32 = 7;
    81    google.protobuf.UInt32Value nullableUInt32 = 8;
    82    google.protobuf.BoolValue nullableBool = 9;
    83    google.protobuf.StringValue nullableString = 10;
    84    google.protobuf.BytesValue nullableBytes = 11;
    85  
    86    google.protobuf.Timestamp timestamp = 12 [(gogoproto.nullable) = false];
    87    google.protobuf.Duration duration = 13 [(gogoproto.nullable) = false];
    88    google.protobuf.DoubleValue nonnullDouble = 14 [(gogoproto.nullable) = false];
    89    google.protobuf.FloatValue nonnullFloat = 15 [(gogoproto.nullable) = false];
    90    google.protobuf.Int64Value nonnullInt64 = 16 [(gogoproto.nullable) = false];
    91    google.protobuf.UInt64Value nonnullUInt64 = 17 [(gogoproto.nullable) = false];
    92    google.protobuf.Int32Value nonnullInt32 = 18 [(gogoproto.nullable) = false];
    93    google.protobuf.UInt32Value nonnullUInt32 = 19 [(gogoproto.nullable) = false];
    94    google.protobuf.BoolValue nonnullBool = 20 [(gogoproto.nullable) = false];
    95    google.protobuf.StringValue nonnullString = 21 [(gogoproto.nullable) = false];
    96    google.protobuf.BytesValue nonnullBytes = 22 [(gogoproto.nullable) = false];
    97  }
    98  
    99  message StdTypes {
   100    google.protobuf.Timestamp nullableTimestamp = 1 [(gogoproto.stdtime) = true];
   101    google.protobuf.Duration nullableDuration = 2 [(gogoproto.stdduration) = true];
   102    google.protobuf.DoubleValue nullableDouble = 3 [(gogoproto.wktpointer) = true];;
   103    google.protobuf.FloatValue nullableFloat = 4 [(gogoproto.wktpointer) = true];;
   104    google.protobuf.Int64Value nullableInt64 = 5 [(gogoproto.wktpointer) = true];;
   105    google.protobuf.UInt64Value nullableUInt64 = 6 [(gogoproto.wktpointer) = true];;
   106    google.protobuf.Int32Value nullableInt32 = 7 [(gogoproto.wktpointer) = true];;
   107    google.protobuf.UInt32Value nullableUInt32 = 8 [(gogoproto.wktpointer) = true];;
   108    google.protobuf.BoolValue nullableBool = 9 [(gogoproto.wktpointer) = true];;
   109    google.protobuf.StringValue nullableString = 10 [(gogoproto.wktpointer) = true];;
   110    google.protobuf.BytesValue nullableBytes = 11 [(gogoproto.wktpointer) = true];;
   111  
   112    google.protobuf.Timestamp timestamp = 12 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
   113    google.protobuf.Duration duration = 13 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false];
   114    google.protobuf.DoubleValue nonnullDouble = 14 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   115    google.protobuf.FloatValue nonnullFloat = 15 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   116    google.protobuf.Int64Value nonnullInt64 = 16 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   117    google.protobuf.UInt64Value nonnullUInt64 = 17 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   118    google.protobuf.Int32Value nonnullInt32 = 18 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   119    google.protobuf.UInt32Value nonnullUInt32 = 19 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   120    google.protobuf.BoolValue nonnullBool = 20 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   121    google.protobuf.StringValue nonnullString = 21 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   122    google.protobuf.BytesValue nonnullBytes = 22 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   123  }
   124  
   125  message RepProtoTypes {
   126    option (gogoproto.compare) = true;
   127    repeated google.protobuf.Timestamp nullableTimestamps = 1;
   128    repeated google.protobuf.Duration nullableDurations = 2;
   129    repeated google.protobuf.Timestamp timestamps = 3 [(gogoproto.nullable) = false];
   130    repeated google.protobuf.Duration durations = 4 [(gogoproto.nullable) = false];
   131  
   132    repeated google.protobuf.DoubleValue nullableDouble = 5;
   133    repeated google.protobuf.DoubleValue nonnullDouble = 6 [(gogoproto.nullable) = false];
   134  
   135    repeated google.protobuf.FloatValue nullableFloat = 7;
   136    repeated google.protobuf.FloatValue nonnullFloat = 8 [(gogoproto.nullable) = false];
   137  
   138    repeated google.protobuf.Int64Value nullableInt64 = 9;
   139    repeated google.protobuf.Int64Value nonnullInt64 = 10 [(gogoproto.nullable) = false];
   140  
   141    repeated google.protobuf.UInt64Value nullableUInt64 = 11;
   142    repeated google.protobuf.UInt64Value nonnullUInt64 = 12 [(gogoproto.nullable) = false];
   143  
   144    repeated google.protobuf.Int32Value nullableInt32 = 13;
   145    repeated google.protobuf.Int32Value nonnullInt32 = 14 [(gogoproto.nullable) = false];
   146  
   147    repeated google.protobuf.UInt32Value nullableUInt32 = 15;
   148    repeated google.protobuf.UInt32Value nonnullUInt32 = 16 [(gogoproto.nullable) = false];
   149  
   150    repeated google.protobuf.BoolValue nullableBool = 17;
   151    repeated google.protobuf.BoolValue nonnullBool = 18 [(gogoproto.nullable) = false];
   152  
   153    repeated google.protobuf.StringValue nullableString = 19;
   154    repeated google.protobuf.StringValue nonnullString = 20 [(gogoproto.nullable) = false];
   155  
   156    repeated google.protobuf.BytesValue nullableBytes = 21;
   157    repeated google.protobuf.BytesValue nonnullBytes = 22 [(gogoproto.nullable) = false];
   158  }
   159  
   160  message RepStdTypes {
   161    repeated google.protobuf.Timestamp nullableTimestamps = 1 [(gogoproto.stdtime) = true];
   162    repeated google.protobuf.Duration nullableDurations = 2 [(gogoproto.stdduration) = true];
   163    repeated google.protobuf.Timestamp timestamps = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
   164    repeated google.protobuf.Duration durations = 4 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false];
   165  
   166    repeated google.protobuf.DoubleValue nullableDouble = 5 [(gogoproto.wktpointer) = true];
   167    repeated google.protobuf.DoubleValue nonnullDouble = 6 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   168  
   169    repeated google.protobuf.FloatValue nullableFloat = 7 [(gogoproto.wktpointer) = true];
   170    repeated google.protobuf.FloatValue nonnullFloat = 8 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   171  
   172    repeated google.protobuf.Int64Value nullableInt64 = 9 [(gogoproto.wktpointer) = true];
   173    repeated google.protobuf.Int64Value nonnullInt64 = 10 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   174  
   175    repeated google.protobuf.UInt64Value nullableUInt64 = 11 [(gogoproto.wktpointer) = true];
   176    repeated google.protobuf.UInt64Value nonnullUInt64 = 12 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   177  
   178    repeated google.protobuf.Int32Value nullableInt32 = 13 [(gogoproto.wktpointer) = true];
   179    repeated google.protobuf.Int32Value nonnullInt32 = 14 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   180  
   181    repeated google.protobuf.UInt32Value nullableUInt32 = 15 [(gogoproto.wktpointer) = true];
   182    repeated google.protobuf.UInt32Value nonnullUInt32 = 16 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   183  
   184    repeated google.protobuf.BoolValue nullableBool = 17 [(gogoproto.wktpointer) = true];
   185    repeated google.protobuf.BoolValue nonnullBool = 18 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   186  
   187    repeated google.protobuf.StringValue nullableString = 19 [(gogoproto.wktpointer) = true];
   188    repeated google.protobuf.StringValue nonnullString = 20 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   189  
   190    repeated google.protobuf.BytesValue nullableBytes = 21 [(gogoproto.wktpointer) = true];
   191    repeated google.protobuf.BytesValue nonnullBytes = 22 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   192  }
   193  
   194  message MapProtoTypes {
   195    map<int32,google.protobuf.Timestamp> nullableTimestamp = 1;
   196    map<int32,google.protobuf.Timestamp> timestamp = 2 [(gogoproto.nullable) = false];
   197  
   198    map<int32,google.protobuf.Duration> nullableDuration = 3;
   199    map<int32,google.protobuf.Duration> duration = 4 [(gogoproto.nullable) = false];
   200  
   201    map<int32, google.protobuf.DoubleValue> nullableDouble = 5;
   202    map<int32, google.protobuf.DoubleValue> nonnullDouble = 6 [(gogoproto.nullable) = false];
   203  
   204    map<int32, google.protobuf.FloatValue> nullableFloat = 7;
   205    map<int32, google.protobuf.FloatValue> nonnullFloat = 8 [(gogoproto.nullable) = false];
   206  
   207    map<int32, google.protobuf.Int64Value> nullableInt64 = 9;
   208    map<int32, google.protobuf.Int64Value> nonnullInt64 = 10 [(gogoproto.nullable) = false];
   209  
   210    map<int32, google.protobuf.UInt64Value> nullableUInt64 = 11;
   211    map<int32, google.protobuf.UInt64Value> nonnullUInt64 = 12 [(gogoproto.nullable) = false];
   212  
   213    map<int32, google.protobuf.Int32Value> nullableInt32 = 13;
   214    map<int32, google.protobuf.Int32Value> nonnullInt32 = 14 [(gogoproto.nullable) = false];
   215  
   216    map<int32, google.protobuf.UInt32Value> nullableUInt32 = 15;
   217    map<int32, google.protobuf.UInt32Value> nonnullUInt32 = 16 [(gogoproto.nullable) = false];
   218  
   219    map<int32, google.protobuf.BoolValue> nullableBool = 17;
   220    map<int32, google.protobuf.BoolValue> nonnullBool = 18 [(gogoproto.nullable) = false];
   221  
   222    map<int32, google.protobuf.StringValue> nullableString = 19;
   223    map<int32, google.protobuf.StringValue> nonnullString = 20 [(gogoproto.nullable) = false];
   224  
   225    map<int32, google.protobuf.BytesValue> nullableBytes = 21;
   226    map<int32, google.protobuf.BytesValue> nonnullBytes = 22 [(gogoproto.nullable) = false];
   227  }
   228  
   229  message MapStdTypes {
   230    map<int32,google.protobuf.Timestamp> nullableTimestamp = 1 [(gogoproto.stdtime) = true];
   231    map<int32,google.protobuf.Timestamp> timestamp = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
   232  
   233    map<int32,google.protobuf.Duration> nullableDuration = 3 [(gogoproto.stdduration) = true];
   234    map<int32,google.protobuf.Duration> duration = 4 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false];
   235  
   236    map<int32, google.protobuf.DoubleValue> nullableDouble = 5 [(gogoproto.wktpointer) = true];
   237    map<int32, google.protobuf.DoubleValue> nonnullDouble = 6 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   238  
   239    map<int32, google.protobuf.FloatValue> nullableFloat = 7 [(gogoproto.wktpointer) = true];
   240    map<int32, google.protobuf.FloatValue> nonnullFloat = 8 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   241  
   242    map<int32, google.protobuf.Int64Value> nullableInt64 = 9 [(gogoproto.wktpointer) = true];
   243    map<int32, google.protobuf.Int64Value> nonnullInt64 = 10 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   244  
   245    map<int32, google.protobuf.UInt64Value> nullableUInt64 = 11 [(gogoproto.wktpointer) = true];
   246    map<int32, google.protobuf.UInt64Value> nonnullUInt64 = 12 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   247  
   248    map<int32, google.protobuf.Int32Value> nullableInt32 = 13 [(gogoproto.wktpointer) = true];
   249    map<int32, google.protobuf.Int32Value> nonnullInt32 = 14 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   250  
   251    map<int32, google.protobuf.UInt32Value> nullableUInt32 = 15 [(gogoproto.wktpointer) = true];
   252    map<int32, google.protobuf.UInt32Value> nonnullUInt32 = 16 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   253  
   254    map<int32, google.protobuf.BoolValue> nullableBool = 17 [(gogoproto.wktpointer) = true];
   255    map<int32, google.protobuf.BoolValue> nonnullBool = 18 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   256  
   257    map<int32, google.protobuf.StringValue> nullableString = 19 [(gogoproto.wktpointer) = true];
   258    map<int32, google.protobuf.StringValue> nonnullString = 20 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   259  
   260    map<int32, google.protobuf.BytesValue> nullableBytes = 21 [(gogoproto.wktpointer) = true];
   261    map<int32, google.protobuf.BytesValue> nonnullBytes = 22 [(gogoproto.wktpointer) = true, (gogoproto.nullable) = false];
   262  }
   263  
   264  message OneofProtoTypes {
   265    oneof OneOfProtoTimes {
   266      google.protobuf.Timestamp timestamp = 1;
   267      google.protobuf.Duration duration = 2;
   268      google.protobuf.DoubleValue repDouble = 3;
   269      google.protobuf.FloatValue repFloat = 4;
   270      google.protobuf.Int64Value repInt64 = 5;
   271      google.protobuf.UInt64Value repUInt64 = 6;
   272      google.protobuf.Int32Value repInt32 = 7;
   273      google.protobuf.UInt32Value repUInt32 = 8;
   274      google.protobuf.BoolValue repBool = 9;
   275      google.protobuf.StringValue repString = 10;
   276      google.protobuf.BytesValue repBytes = 11;
   277    }
   278  }
   279  
   280  message OneofStdTypes {
   281    oneof OneOfStdTimes {
   282      google.protobuf.Timestamp timestamp = 1 [(gogoproto.stdtime) = true];
   283      google.protobuf.Duration duration = 2 [(gogoproto.stdduration) = true];
   284      google.protobuf.DoubleValue repDouble = 3 [(gogoproto.wktpointer) = true];
   285      google.protobuf.FloatValue repFloat = 4 [(gogoproto.wktpointer) = true];
   286      google.protobuf.Int64Value repInt64 = 5 [(gogoproto.wktpointer) = true];
   287      google.protobuf.UInt64Value repUInt64 = 6 [(gogoproto.wktpointer) = true];
   288      google.protobuf.Int32Value repInt32 = 7 [(gogoproto.wktpointer) = true];
   289      google.protobuf.UInt32Value repUInt32 = 8 [(gogoproto.wktpointer) = true];
   290      google.protobuf.BoolValue repBool = 9 [(gogoproto.wktpointer) = true];
   291      google.protobuf.StringValue repString = 10 [(gogoproto.wktpointer) = true];
   292      google.protobuf.BytesValue repBytes = 11 [(gogoproto.wktpointer) = true];
   293    }
   294  }
   295