github.com/gogo/protobuf@v1.3.2/test/mapsproto2/mapsproto2.proto (about)

     1  // Protocol Buffers for Go with Gadgets
     2  //
     3  // Copyright (c) 2013, The GoGo Authors. All rights reserved.
     4  // http://github.com/gogo/protobuf
     5  //
     6  // Go support for Protocol Buffers - Google's data interchange format
     7  //
     8  // Copyright 2014 The Go Authors.  All rights reserved.
     9  // https://github.com/golang/protobuf
    10  //
    11  // Redistribution and use in source and binary forms, with or without
    12  // modification, are permitted provided that the following conditions are
    13  // met:
    14  //
    15  //     * Redistributions of source code must retain the above copyright
    16  // notice, this list of conditions and the following disclaimer.
    17  //     * Redistributions in binary form must reproduce the above
    18  // copyright notice, this list of conditions and the following disclaimer
    19  // in the documentation and/or other materials provided with the
    20  // distribution.
    21  //     * Neither the name of Google Inc. nor the names of its
    22  // contributors may be used to endorse or promote products derived from
    23  // this software without specific prior written permission.
    24  //
    25  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    26  // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    27  // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    28  // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    29  // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    30  // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    31  // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    32  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    33  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    34  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    35  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    36  
    37  syntax = "proto2";
    38  
    39  package proto2.maps;
    40  
    41  import "github.com/gogo/protobuf/gogoproto/gogo.proto";
    42  
    43  option (gogoproto.goproto_stringer_all) = false;
    44  option (gogoproto.goproto_enum_prefix_all) = false;
    45  option (gogoproto.goproto_getters_all) = false;
    46  
    47  option (gogoproto.equal_all) = true;
    48  option (gogoproto.verbose_equal_all) = true;
    49  option (gogoproto.stringer_all) = true;
    50  option (gogoproto.gostring_all) = true;
    51  option (gogoproto.face_all) = true;
    52  option (gogoproto.description_all) = true;
    53  
    54  option (gogoproto.testgen_all) = true;
    55  option (gogoproto.populate_all) = true;
    56  option (gogoproto.benchgen_all) = true;
    57  option (gogoproto.unmarshaler_all) = false;
    58  option (gogoproto.marshaler_all) = false;
    59  option (gogoproto.sizer_all) = true;
    60  
    61  option (gogoproto.goproto_enum_stringer_all) = false;
    62  option (gogoproto.enum_stringer_all) = true;
    63  
    64  option (gogoproto.unsafe_marshaler_all) = false;
    65  option (gogoproto.unsafe_unmarshaler_all) = false;
    66  
    67  message FloatingPoint {
    68    optional double f = 1;
    69  }
    70  
    71  message CustomMap {
    72    map<string, bytes> Nullable128s = 1 [(gogoproto.customtype)="github.com/gogo/protobuf/test/custom.Uint128"];
    73    map<string, bytes> Uint128s = 2 [(gogoproto.customtype)="github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable)=false];
    74    map<string, bytes> NullableIds = 3 [(gogoproto.customtype)="github.com/gogo/protobuf/test.Uuid"];
    75    map<string, bytes> Ids = 4 [(gogoproto.customtype)="github.com/gogo/protobuf/test.Uuid", (gogoproto.nullable)=false];
    76  }
    77  
    78  enum MapEnum {
    79    MA = 0;
    80    MB = 1;
    81    MC = 2;
    82  }
    83  
    84  message AllMaps {
    85    map<string, double> StringToDoubleMap = 1;
    86    map<string, float> StringToFloatMap = 2;
    87    map<int32, int32> Int32Map = 3;
    88    map<int64, int64> Int64Map = 4;
    89    map<uint32, uint32> Uint32Map = 5;
    90    map<uint64, uint64> Uint64Map = 6;
    91    map<sint32, sint32> Sint32Map = 7;
    92    map<sint64, sint64> Sint64Map = 8;
    93    map<fixed32, fixed32> Fixed32Map = 9;
    94    map<sfixed32, sfixed32> Sfixed32Map = 10;
    95    map<fixed64, fixed64> Fixed64Map = 11;
    96    map<sfixed64, sfixed64> Sfixed64Map = 12;
    97    map<bool, bool> BoolMap = 13;
    98    map<string, string> StringMap = 14;
    99    map<string, bytes> StringToBytesMap = 15;
   100    map<string, MapEnum> StringToEnumMap = 16;
   101    map<string, FloatingPoint> StringToMsgMap = 17;
   102  }
   103  
   104  message AllMapsOrdered {
   105    option (gogoproto.stable_marshaler) = true;
   106  
   107    map<string, double> StringToDoubleMap = 1;
   108    map<string, float> StringToFloatMap = 2;
   109    map<int32, int32> Int32Map = 3;
   110    map<int64, int64> Int64Map = 4;
   111    map<uint32, uint32> Uint32Map = 5;
   112    map<uint64, uint64> Uint64Map = 6;
   113    map<sint32, sint32> Sint32Map = 7;
   114    map<sint64, sint64> Sint64Map = 8;
   115    map<fixed32, fixed32> Fixed32Map = 9;
   116    map<sfixed32, sfixed32> Sfixed32Map = 10;
   117    map<fixed64, fixed64> Fixed64Map = 11;
   118    map<sfixed64, sfixed64> Sfixed64Map = 12;
   119    map<bool, bool> BoolMap = 13;
   120    map<string, string> StringMap = 14;
   121    map<string, bytes> StringToBytesMap = 15;
   122    map<string, MapEnum> StringToEnumMap = 16;
   123    map<string, FloatingPoint> StringToMsgMap = 17;
   124  }