github.com/cloudwego/dynamicgo@v0.2.6-0.20240519101509-707f41b6b834/testdata/idl/example2.proto (about)

     1  // Copyright 2018 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Test Protobuf definitions with proto3 syntax.
     6  syntax = "proto3";
     7  
     8  package pb3;
     9  
    10  import "base.proto";
    11  
    12  option go_package = "pb/example2";
    13  
    14  enum FOO {
    15      FOO_A = 0;
    16  }
    17  
    18  message InnerBase2 {
    19      bool Bool = 1;
    20      uint32 Uint32 = 2;
    21      uint64 Uint64 = 3;
    22      int32 Int32 = 4;
    23      int64 Int64 = 5;
    24      double Double = 6;
    25      string String = 7;
    26      repeated int32 ListInt32 = 8;
    27      map<string, string> MapStringString = 9;
    28      repeated int32 SetInt32 = 10;
    29      FOO Foo = 11;
    30      map<int32, string> MapInt32String = 12;
    31      bytes Binary = 13;
    32      map<uint32, string> MapUint32String = 14;
    33      map<uint64, string> MapUint64String = 15;
    34      map<int64, string> MapInt64String = 16;
    35      map<int64, Base> MapInt64Base = 17;
    36      map<string, Base> MapStringBase = 20;
    37  
    38      repeated Base ListBase = 19;
    39      repeated InnerBase2 ListInnerBase = 18;
    40      repeated string ListString = 21;
    41      
    42  
    43      Base Base = 255;
    44  }
    45  
    46  
    47  message InnerBasePartial {
    48      bool Bool = 1;
    49      repeated int32 ListInt32 = 8;
    50      map<string, string> MapStringString = 9;
    51      map<string, BasePartial> MapStringBase = 20;
    52      repeated InnerBasePartial ListInnerBase = 18;
    53      repeated BasePartial ListBase = 19;
    54  
    55      map<string, string> MapStringString2 = 127;
    56  }
    57  
    58  message BasePartial {
    59      TrafficEnv TrafficEnv = 5;
    60  }
    61  
    62  
    63  message ExampleReq {
    64      string Msg = 1;
    65      int32 A = 2;
    66      InnerBase2 InnerBase2 = 3;
    67      Base Base = 255;
    68      double Subfix = 32767;
    69  }
    70  
    71  
    72  message ExampleSuper {
    73      string Msg = 1;
    74      int32 A = 2;
    75      InnerBase2 InnerBase2 = 3;
    76      string Ex1 = 4;
    77      string Ex2 = 5;
    78      string Ex3 = 6;
    79      string Ex4 = 7;
    80      SelfRef SelfRef = 9;
    81      Base Base = 255;
    82      double Subfix = 32767;
    83  }
    84  
    85  message SelfRef {
    86      SelfRef self = 1;
    87  }
    88  
    89  message ExampleReqPartial {
    90      string Msg = 1;
    91      InnerBasePartial InnerBase2 = 3;
    92      BasePartial Base = 255;
    93  }
    94  
    95  
    96  message ExampleResp {
    97      string Msg = 1;
    98      string required_field = 2;
    99      BaseResp BaseResp = 255;
   100  }
   101  
   102  message ExampleRespPartial {
   103      string required_field = 2;
   104      BaseResp BaseResp = 255;
   105  }
   106  
   107  message Exception {
   108      int32 code = 1;
   109      string msg = 255;
   110  }
   111  
   112  message A {
   113      A self = 1;
   114  }
   115  
   116  message PingResponse {
   117      string message = 1;
   118  }
   119  
   120  message OnewayRequest {
   121      string msg = 1;
   122  }
   123  
   124  message VoidRequest {
   125      string msg = 1;
   126  }
   127  
   128  message VoidResponse {
   129      
   130  }
   131  
   132  message ExampleInt2Float {
   133      int32 Int32 = 1;
   134      double Float64 = 2;
   135      string String = 3;
   136      int64 Int64 = 4;
   137      double Subfix = 32767;
   138  }
   139  
   140  
   141  
   142  // Test that RPC services work.
   143  service TestService2 {
   144    rpc ExampleMethod(ExampleReq) returns (ExampleResp);
   145    rpc ExamplePartialMethod(ExampleReqPartial) returns (A);
   146    rpc ExamplePartialMethod2(ExampleReqPartial) returns (ExampleRespPartial);
   147    rpc ExampleSuperMethod(ExampleSuper) returns (A);
   148    rpc Int2FloatMethod(ExampleInt2Float) returns (ExampleInt2Float);
   149    rpc Foo(A) returns (A);
   150    rpc Ping(A) returns (PingResponse);
   151    rpc Oneway(OnewayRequest) returns (VoidResponse);
   152    rpc Void(VoidRequest) returns (VoidResponse);
   153  }