github.com/cloudwego/dynamicgo@v0.2.6-0.20240519101509-707f41b6b834/testdata/idl/example2.thrift (about) 1 include "base.thrift" 2 namespace go example2 3 4 enum FOO { 5 A = 1; 6 } 7 8 struct InnerBase { 9 1: bool Bool, 10 2: byte Byte, 11 3: i16 Int16, 12 4: i32 Int32, 13 5: i64 Int64, 14 6: double Double, 15 7: string String, 16 8: list<i32> ListInt32, 17 9: map<string, string> MapStringString, 18 10: set<i32> SetInt32, 19 11: FOO Foo, 20 12: map<i32, string> MapInt32String, 21 13: binary Binary, 22 14: map<byte, string> MapInt8String, 23 15: map<i16, string> MapInt16String, 24 16: map<i64, string> MapInt64String, 25 17: map<double, string> MapDoubleString, 26 27 18: list<InnerBase> ListInnerBase, 28 19: map<InnerBase, InnerBase> MapInnerBaseInnerBase, 29 30 255: base.Base Base, 31 } 32 33 struct InnerBasePartial { 34 1: bool Bool, 35 8: list<i32> ListInt32, 36 9: map<string, string> MapStringString, 37 17: map<double, string> MapDoubleString, 38 18: list<InnerBasePartial> ListInnerBase, 39 19: map<InnerBasePartial, InnerBasePartial> MapInnerBaseInnerBase, 40 41 127: map<string, string> MapStringString2 42 } 43 44 struct BasePartial { 45 5: optional base.TrafficEnv TrafficEnv, 46 } 47 48 struct ExampleReq { 49 1: optional string Msg, 50 2: optional i32 A, 51 3: InnerBase InnerBase (agw.to_snake="true"), 52 255: required base.Base Base, 53 32767: double Subfix, 54 } 55 56 struct ExampleSuper { 57 1: optional string Msg, 58 2: optional i32 A, 59 3: InnerBase InnerBase, 60 4: string Ex1, 61 5: optional string Ex2, 62 6: optional string Ex3, 63 7: required string Ex4, 64 // 8: map<BasePartial,BasePartial> MapStructStruct, 65 9: SelfRef SelfRef, 66 255: required base.Base Base, 67 32767: double Subfix, 68 } 69 70 struct SelfRef { 71 1: optional SelfRef self, 72 } 73 74 struct ExampleReqPartial { 75 1: optional string Msg, 76 3: InnerBasePartial InnerBase, 77 255: BasePartial Base, 78 } 79 80 struct ExampleResp { 81 1: optional string Msg, 82 2: required string required_field 83 255: base.BaseResp BaseResp, 84 } 85 86 exception Exception { 87 1: i32 code 88 255: string msg 89 } 90 91 struct A { 92 1: A self 93 } 94 95 service ExampleService { 96 ExampleResp ExampleMethod(1: ExampleReq req)throws(1: Exception err), 97 A ExamplePartialMethod(1: ExampleReqPartial req), 98 A ExampleSuperMethod(1: ExampleSuper req), 99 A Foo(1: A req) 100 string Ping(1: string msg) 101 oneway void Oneway(1: string msg) 102 void Void(1: string msg) 103 }