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

     1  include "base.thrift"
     2  include "deep/deep.ref.thrift"
     3  include "example.thrift"
     4  include "ref.thrift"
     5  namespace go example
     6  
     7  struct ExampleReq {
     8      1: optional string Msg,
     9      3: i32 InnerBase,
    10      255: required base.Base Base,
    11      32767: double Subfix,
    12  }
    13  
    14  struct ExampleToSnakeCase {
    15      1: optional string Msg,
    16      2: list<string> req_list,
    17      3: i32 InnerBase,
    18      255: required base.Base Base,
    19  }
    20  
    21  struct ExampleResp {
    22      1: optional string Msg,
    23      2: required string required_field
    24      32767: base.BaseResp BaseResp,
    25  }
    26  
    27  exception Exception {
    28      1: i32 code
    29      255: string msg
    30  }
    31  
    32  struct A {
    33      // 1: A self
    34      // 1024: self_ref.A a
    35      1: string self,
    36      2:FOO foo
    37  }
    38  
    39  enum FOO {
    40      B,
    41      A,
    42  }
    43  
    44  struct ExampleDefaultValue {
    45      1: string String = "default"
    46      2: i32 Int = 1
    47      3: double Double = 1.1
    48      4: bool Bool = true
    49      5: list<string> List = ["a", "b"]
    50      6: map<string, string> Map = {"a": "b"}
    51      7: set<string> Set = ["a", "b"]
    52      8: string ConstString = deep.ref.ConstString
    53      9: FOO Enum = FOO.A
    54  }
    55  
    56  struct DeepRef {
    57      1: deep.ref.TestStruct DeepRef
    58  }
    59  
    60  service ExampleService {
    61      DeepRef ExampleDeepRef(1: DeepRef req)
    62      ExampleResp ExampleMethod(1: ExampleReq req)throws(1: Exception err),
    63      A Foo(1: A req)
    64      string Ping(1: string msg)
    65      oneway void Oneway(1: string msg)
    66      void Void(1: string msg)
    67      void ExampleToSnakeCase(1: ExampleToSnakeCase req) (agw.to_snake = "")
    68      ExampleDefaultValue ExampleDefaultValue(1: ExampleDefaultValue req)
    69  }