From e322850e2a862094bd26d0f6c8f21376b320a453 Mon Sep 17 00:00:00 2001 From: Jack Chistyakov Date: Tue, 1 Oct 2024 03:32:06 -0700 Subject: [PATCH] Metadata optimize types Summary: Metadata logic has an inefficiency where is will generate duplicate metadata for external types (types defined in another Thrift file). For example: ``` foo.thrift: struct MyFooStruct {} premadeMyFooStructType = bar.thrift: include foo.thrift struct MyBarStruct { 1: foo.MyFooStruct field; } premadeMyFooStructType = premadeMyBarStructType = ``` In the above example - you can see that we define `premadeMyFooStructType` twice - in the original package (foo.thrift) and in the package that imports foo.thrift - bar.thrift. To make things efficient we want this: ``` foo.thrift: struct MyFooStruct {} premadeMyFooStructType = bar.thrift: include foo.thrift struct MyBarStruct { 1: foo.MyFooStruct field; } premadeMyBarStructType = ``` Reviewed By: leoleovich Differential Revision: D63490533 fbshipit-source-id: c2eb9c504b3ab732ba76d7416cfbafc568c0e5dc --- .../compiler/generate/t_mstch_go_generator.cc | 38 +++++++- .../templates/go/metadata.go.mustache | 14 +++ .../metadata/thrift_metadata_field.mustache | 2 +- .../thrift_metadata_function.mustache | 2 +- .../go/metadata/thrift_type_instance.mustache | 10 +- thrift/compiler/lib/go/util.cc | 8 ++ .../adapter/out/go/gen-go/module/metadata.go | 91 +++++++++++++++++++ .../gen-go/thrift/annotation/cpp/metadata.go | 31 +++++++ .../gen-go/thrift/annotation/hack/metadata.go | 20 ++++ .../thrift/annotation/python/metadata.go | 17 ++++ .../gen-go/thrift/annotation/rust/metadata.go | 25 +++++ .../thrift/annotation/scope/metadata.go | 26 ++++++ .../thrift/annotation/thrift/metadata.go | 29 ++++++ .../out/go/gen-go/module/metadata.go | 23 +++++ .../gen-go/thrift/annotation/cpp/metadata.go | 31 +++++++ .../gen-go/thrift/annotation/go/metadata.go | 12 +++ .../gen-go/thrift/annotation/hack/metadata.go | 20 ++++ .../thrift/annotation/scope/metadata.go | 26 ++++++ .../thrift/annotation/thrift/metadata.go | 29 ++++++ .../basic/out/go/gen-go/module/metadata.go | 28 ++++++ .../gen-go/thrift/annotation/hack/metadata.go | 20 ++++ .../thrift/annotation/scope/metadata.go | 26 ++++++ .../thrift/annotation/thrift/metadata.go | 29 ++++++ .../out/go/gen-go/module/metadata.go | 23 +++++ .../gen-go/thrift/annotation/cpp/metadata.go | 31 +++++++ .../thrift/annotation/scope/metadata.go | 26 ++++++ .../thrift/annotation/thrift/metadata.go | 29 ++++++ .../out/go/gen-go/module/metadata.go | 28 ++++++ .../out/go/gen-go/module/metadata.go | 13 +++ .../doctext/out/go/gen-go/module/metadata.go | 18 ++++ .../out/go/gen-go/module/metadata.go | 11 +++ .../enums/out/go/gen-go/module/metadata.go | 19 ++++ .../thrift/annotation/scope/metadata.go | 26 ++++++ .../thrift/annotation/thrift/metadata.go | 29 ++++++ .../out/go/gen-go/module/metadata.go | 19 ++++ .../thrift/annotation/python/metadata.go | 17 ++++ .../thrift/annotation/scope/metadata.go | 26 ++++++ .../thrift/annotation/thrift/metadata.go | 29 ++++++ .../out/go/gen-go/module/metadata.go | 20 ++++ .../out/go_module0/gen-go/module0/metadata.go | 13 +++ .../out/go_module1/gen-go/module0/metadata.go | 13 +++ .../out/go_module1/gen-go/module1/metadata.go | 43 ++++++--- .../out/go_module1/gen-go/module2/metadata.go | 10 ++ .../gen-go/thrift/annotation/go/metadata.go | 12 +++ .../thrift/annotation/scope/metadata.go | 26 ++++++ .../out/go_module2/gen-go/module2/metadata.go | 10 ++ .../gen-go/IncludesAlso/metadata.go | 10 ++ .../gen-go/matching_names/metadata.go | 16 +++- .../go_service/gen-go/includes/metadata.go | 21 +++-- .../out/go_service/gen-go/module/metadata.go | 26 +++--- .../out/go_service/gen-go/service/metadata.go | 41 ++++----- .../go_service/gen-go/transitive/metadata.go | 11 +++ .../out/go/gen-go/module/metadata.go | 10 ++ .../out/go/gen-go/foo/metadata.go | 11 +++ .../out/go/gen-go/module/metadata.go | 14 +++ .../thrift/annotation/internals/metadata.go | 11 +++ .../thrift/annotation/scope/metadata.go | 26 ++++++ .../thrift/annotation/thrift/metadata.go | 29 ++++++ .../out/go/gen-go/module/metadata.go | 18 +++- .../out/go/gen-go/shared/metadata.go | 12 +++ .../gen-go/thrift/annotation/cpp/metadata.go | 31 +++++++ .../thrift/annotation/scope/metadata.go | 26 ++++++ .../thrift/annotation/thrift/metadata.go | 29 ++++++ .../my/namespacing/test/module/metadata.go | 11 +++ .../out/go_emptyns/gen-go/emptyns/metadata.go | 11 +++ .../my/namespacing/extend/test/metadata.go | 16 +++- .../gen-go/my/namespacing/test/metadata.go | 11 +++ .../gen-go/my/namespacing/test/metadata.go | 11 +++ .../my/namespacing/test/module/metadata.go | 11 +++ .../namespace_from_package/module/metadata.go | 11 +++ .../module/metadata.go | 11 +++ .../out/go/gen-go/module/metadata.go | 19 ++++ .../params/out/go/gen-go/module/metadata.go | 11 +++ .../out/go/gen-go/module/metadata.go | 12 +++ .../thrift/annotation/scope/metadata.go | 26 ++++++ .../thrift/annotation/thrift/metadata.go | 29 ++++++ .../out/go/gen-go/terse_write/metadata.go | 29 ++++++ .../gen-go/thrift/annotation/cpp/metadata.go | 31 +++++++ .../gen-go/thrift/annotation/hack/metadata.go | 20 ++++ .../thrift/annotation/scope/metadata.go | 26 ++++++ .../thrift/annotation/thrift/metadata.go | 29 ++++++ .../types/out/go/gen-go/included/metadata.go | 13 +++ .../types/out/go/gen-go/module/metadata.go | 86 +++++++++++++++--- .../gen-go/thrift/annotation/cpp/metadata.go | 31 +++++++ .../thrift/annotation/scope/metadata.go | 26 ++++++ .../thrift/annotation/thrift/metadata.go | 29 ++++++ 86 files changed, 1802 insertions(+), 98 deletions(-) diff --git a/thrift/compiler/generate/t_mstch_go_generator.cc b/thrift/compiler/generate/t_mstch_go_generator.cc index 07a5ca709d6..a48f7abb53b 100644 --- a/thrift/compiler/generate/t_mstch_go_generator.cc +++ b/thrift/compiler/generate/t_mstch_go_generator.cc @@ -685,8 +685,11 @@ class mstch_go_type : public mstch_type { { {"type:go_comparable?", &mstch_go_type::is_go_comparable}, {"type:metadata_primitive?", &mstch_go_type::is_metadata_primitive}, + {"type:named?", &mstch_go_type::has_name}, {"type:full_name", &mstch_go_type::full_name}, {"type:metadata_name", &mstch_go_type::metadata_name}, + {"type:metadata_thrift_type_getter", + &mstch_go_type::metadata_thrift_type_getter}, }); } @@ -697,19 +700,44 @@ class mstch_go_type : public mstch_type { auto real_type = type_->get_true_type(); return go::is_type_metadata_primitive(real_type); } + mstch::node has_name() { return !type_->name().empty(); } mstch::node full_name() { return type_->get_full_name(); } - mstch::node metadata_name() { + mstch::node metadata_name() { return metadata_name_(); } + mstch::node metadata_thrift_type_getter() { + // Program will be null for primitive (base) types. + // They should be treated as being from the current program. + auto is_from_current_program = type_->get_program() == nullptr || + data_.is_current_program(type_->get_program()); + + if (is_from_current_program) { + // If the type is from the current program, we can simply use its + // corresponding *ThriftType variable already present in the program. + return metadata_name_(); + } else { + // If the type is external, we must retrieve it from its corresponding + // program/package using GetMetadataThriftType helper method. + return fmt::format( + "{}.GetMetadataThriftType(\"{}\")", + data_.get_go_package_alias(type_->program()), + type_->get_full_name()); + } + } + + private: + go::codegen_data& data_; + + std::string metadata_name_() { + return "premadeThriftType_" + sanitized_full_name_(); + } + std::string sanitized_full_name_() { std::string full_name = type_->get_full_name(); boost::replace_all(full_name, " ", ""); boost::replace_all(full_name, ".", "_"); boost::replace_all(full_name, ",", "_"); boost::replace_all(full_name, "<", "_"); boost::replace_all(full_name, ">", ""); - return "premadeThriftType_" + full_name; + return full_name; } - - private: - go::codegen_data& data_; }; class mstch_go_typedef : public mstch_typedef { diff --git a/thrift/compiler/generate/templates/go/metadata.go.mustache b/thrift/compiler/generate/templates/go/metadata.go.mustache index 971e33de8fe..e07c95b05e2 100644 --- a/thrift/compiler/generate/templates/go/metadata.go.mustache +++ b/thrift/compiler/generate/templates/go/metadata.go.mustache @@ -53,6 +53,14 @@ var ( {{/program:thrift_metadata_types}} ) +var premadeThriftTypesMap = map[string]*{{program:metadata_qualifier}}ThriftType{ + {{#program:thrift_metadata_types}} + {{#type:named?}} + "{{type:full_name}}": {{type:metadata_name}}, + {{/type:named?}} + {{/program:thrift_metadata_types}} +} + var structMetadatas = []*{{program:metadata_qualifier}}ThriftStruct{ {{#program:structs}} {{^struct:exception?}} @@ -81,6 +89,12 @@ var serviceMetadatas = []*{{program:metadata_qualifier}}ThriftService{ {{/program:services}} } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *{{program:metadata_qualifier}}ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *{{program:metadata_qualifier}}ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/generate/templates/go/metadata/thrift_metadata_field.mustache b/thrift/compiler/generate/templates/go/metadata/thrift_metadata_field.mustache index 9a79d0a723b..43cb40ebbcc 100644 --- a/thrift/compiler/generate/templates/go/metadata/thrift_metadata_field.mustache +++ b/thrift/compiler/generate/templates/go/metadata/thrift_metadata_field.mustache @@ -23,4 +23,4 @@ SetId({{field:key}}). SetName("{{field:name}}"). SetIsOptional({{#field:optional?}}true{{/field:optional?}}{{^field:optional?}}false{{/field:optional?}}). - SetType({{#field:type}}{{type:metadata_name}}{{/field:type}}) + SetType({{#field:type}}{{type:metadata_thrift_type_getter}}{{/field:type}}) diff --git a/thrift/compiler/generate/templates/go/metadata/thrift_metadata_function.mustache b/thrift/compiler/generate/templates/go/metadata/thrift_metadata_function.mustache index a7b850ce1d0..71e40589bd9 100644 --- a/thrift/compiler/generate/templates/go/metadata/thrift_metadata_function.mustache +++ b/thrift/compiler/generate/templates/go/metadata/thrift_metadata_function.mustache @@ -22,7 +22,7 @@ {{program:metadata_qualifier}}NewThriftFunction(). SetName("{{function:name}}"). SetIsOneway({{#function:oneway?}}true{{/function:oneway?}}{{^function:oneway?}}false{{/function:oneway?}}). - SetReturnType({{#function:return_type}}{{type:metadata_name}}{{/function:return_type}}){{#function:args?}}. + SetReturnType({{#function:return_type}}{{type:metadata_thrift_type_getter}}{{/function:return_type}}){{#function:args?}}. SetArguments( []*{{program:metadata_qualifier}}ThriftField{ {{#function:args}} diff --git a/thrift/compiler/generate/templates/go/metadata/thrift_type_instance.mustache b/thrift/compiler/generate/templates/go/metadata/thrift_type_instance.mustache index 384d481b0a3..17dbdd1a9ff 100644 --- a/thrift/compiler/generate/templates/go/metadata/thrift_type_instance.mustache +++ b/thrift/compiler/generate/templates/go/metadata/thrift_type_instance.mustache @@ -24,7 +24,7 @@ {{#typedef:defined_kind?}} {{program:metadata_qualifier}}NewThriftTypedefType(). SetName("{{typedef:scoped_name}}"). - SetUnderlyingType({{#type:typedef_type}}{{type:metadata_name}}{{/type:typedef_type}}), + SetUnderlyingType({{#type:typedef_type}}{{type:metadata_thrift_type_getter}}{{/type:typedef_type}}), {{/typedef:defined_kind?}} {{^typedef:defined_kind?}} {{#type:typedef_type}} @@ -58,18 +58,18 @@ {{#type:list?}} {{#type:list_elem_type}} {{program:metadata_qualifier}}NewThriftListType(). - SetValueType({{type:metadata_name}}), + SetValueType({{type:metadata_thrift_type_getter}}), {{/type:list_elem_type}} {{/type:list?}} {{#type:map?}} {{program:metadata_qualifier}}NewThriftMapType(). - SetKeyType({{#type:key_type}}{{type:metadata_name}}{{/type:key_type}}). - SetValueType({{#type:value_type}}{{type:metadata_name}}{{/type:value_type}}), + SetKeyType({{#type:key_type}}{{type:metadata_thrift_type_getter}}{{/type:key_type}}). + SetValueType({{#type:value_type}}{{type:metadata_thrift_type_getter}}{{/type:value_type}}), {{/type:map?}} {{#type:set?}} {{#type:set_elem_type}} {{program:metadata_qualifier}}NewThriftSetType(). - SetValueType({{type:metadata_name}}), + SetValueType({{type:metadata_thrift_type_getter}}), {{/type:set_elem_type}} {{/type:set?}} {{/type:typedef?}} diff --git a/thrift/compiler/lib/go/util.cc b/thrift/compiler/lib/go/util.cc index 023e765c353..2ce6cd4c0ee 100644 --- a/thrift/compiler/lib/go/util.cc +++ b/thrift/compiler/lib/go/util.cc @@ -188,6 +188,14 @@ void codegen_data::add_to_thrift_metadata_types( add_to_thrift_metadata_types(val_type, visited_type_names); } + // Filter out external types (i.e. types defined in other programs). + // Primitive (base) types should be treated as internal and kept. + // For those types - 'program' will be null, so account for that. + if (type->get_program() != nullptr && + !is_current_program(type->get_program())) { + return; + } + thrift_metadata_types.push_back(type); } diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/metadata.go index 7dd7705c976..92a6c8168c2 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/metadata.go @@ -413,6 +413,91 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "module.Color": premadeThriftType_module_Color, + "module.ThriftAdaptedEnum": premadeThriftType_module_ThriftAdaptedEnum, + "string": premadeThriftType_string, + "module.MyAnnotation": premadeThriftType_module_MyAnnotation, + "i32": premadeThriftType_i32, + "module.i32_5137": premadeThriftType_module_i32_5137, + "module.SetWithAdapter": premadeThriftType_module_SetWithAdapter, + "module.StringWithAdapter": premadeThriftType_module_StringWithAdapter, + "module.ListWithElemAdapter": premadeThriftType_module_ListWithElemAdapter, + "module.ListWithElemAdapter_withAdapter": premadeThriftType_module_ListWithElemAdapter_withAdapter, + "module.ListWithElemAdapter_withAdapter_2312": premadeThriftType_module_ListWithElemAdapter_withAdapter_2312, + "module.map_string_ListWithElemAdapter_withAdapter_8454": premadeThriftType_module_map_string_ListWithElemAdapter_withAdapter_8454, + "binary": premadeThriftType_binary, + "module.binary_5673": premadeThriftType_module_binary_5673, + "i64": premadeThriftType_i64, + "module.MyI64": premadeThriftType_module_MyI64, + "module.DoubleTypedefI64": premadeThriftType_module_DoubleTypedefI64, + "module.Foo": premadeThriftType_module_Foo, + "module.Baz": premadeThriftType_module_Baz, + "module.Foo_6868": premadeThriftType_module_Foo_6868, + "module.Foo_3943": premadeThriftType_module_Foo_3943, + "module.FooWithAdapter": premadeThriftType_module_FooWithAdapter, + "module.FooWithAdapter_9317": premadeThriftType_module_FooWithAdapter_9317, + "module.Baz_7352": premadeThriftType_module_Baz_7352, + "module.DirectlyAdapted": premadeThriftType_module_DirectlyAdapted, + "module.Bar": premadeThriftType_module_Bar, + "module.IndependentDirectlyAdapted": premadeThriftType_module_IndependentDirectlyAdapted, + "module.StructWithFieldAdapter": premadeThriftType_module_StructWithFieldAdapter, + "module.TerseAdaptedFields": premadeThriftType_module_TerseAdaptedFields, + "module.A": premadeThriftType_module_A, + "module.AdaptedA": premadeThriftType_module_AdaptedA, + "module.B": premadeThriftType_module_B, + "module.Config": premadeThriftType_module_Config, + "module.MyStruct": premadeThriftType_module_MyStruct, + "module.DurationMs": premadeThriftType_module_DurationMs, + "module.IOBuf": premadeThriftType_module_IOBuf, + "module.CustomProtocolType": premadeThriftType_module_CustomProtocolType, + "module.IndirectionString": premadeThriftType_module_IndirectionString, + "bool": premadeThriftType_bool, + "module.AdaptedBool": premadeThriftType_module_AdaptedBool, + "module.AdaptedInteger": premadeThriftType_module_AdaptedInteger, + "module.AdaptTestStruct": premadeThriftType_module_AdaptTestStruct, + "byte": premadeThriftType_byte, + "module.AdaptedByte": premadeThriftType_module_AdaptedByte, + "i16": premadeThriftType_i16, + "module.AdaptedShort": premadeThriftType_module_AdaptedShort, + "module.AdaptedLong": premadeThriftType_module_AdaptedLong, + "double": premadeThriftType_double, + "module.AdaptedDouble": premadeThriftType_module_AdaptedDouble, + "module.AdaptedString": premadeThriftType_module_AdaptedString, + "module.AdaptedEnum": premadeThriftType_module_AdaptedEnum, + "module.DoubleTypedefBool": premadeThriftType_module_DoubleTypedefBool, + "module.AdaptTemplatedTestStruct": premadeThriftType_module_AdaptTemplatedTestStruct, + "module.AdaptTemplatedNestedTestStruct": premadeThriftType_module_AdaptTemplatedNestedTestStruct, + "module.AdaptTestUnion": premadeThriftType_module_AdaptTestUnion, + "module.AdaptedStruct": premadeThriftType_module_AdaptedStruct, + "module.DirectlyAdaptedStruct": premadeThriftType_module_DirectlyAdaptedStruct, + "module.AdaptedTypedef": premadeThriftType_module_AdaptedTypedef, + "module.TypedefOfDirect": premadeThriftType_module_TypedefOfDirect, + "module.StructFieldAdaptedStruct": premadeThriftType_module_StructFieldAdaptedStruct, + "module.CircularStruct": premadeThriftType_module_CircularStruct, + "module.CircularAdaptee": premadeThriftType_module_CircularAdaptee, + "module.AdaptedCircularAdaptee": premadeThriftType_module_AdaptedCircularAdaptee, + "module.DeclaredAfterStruct": premadeThriftType_module_DeclaredAfterStruct, + "module.ReorderedStruct": premadeThriftType_module_ReorderedStruct, + "module.RenamedStruct": premadeThriftType_module_RenamedStruct, + "module.SameNamespaceStruct": premadeThriftType_module_SameNamespaceStruct, + "module.HeapAllocated": premadeThriftType_module_HeapAllocated, + "module.MoveOnly": premadeThriftType_module_MoveOnly, + "module.AlsoMoveOnly": premadeThriftType_module_AlsoMoveOnly, + "module.ApplyAdapter": premadeThriftType_module_ApplyAdapter, + "module.TransitiveAdapted": premadeThriftType_module_TransitiveAdapted, + "module.CountingInt": premadeThriftType_module_CountingInt, + "module.CountingStruct": premadeThriftType_module_CountingStruct, + "module.Person": premadeThriftType_module_Person, + "module.Person2": premadeThriftType_module_Person2, + "module.RenamedStructWithStructAdapterAndFieldAdapter": premadeThriftType_module_RenamedStructWithStructAdapterAndFieldAdapter, + "module.MyI32": premadeThriftType_module_MyI32, + "module.StructWithAdapter": premadeThriftType_module_StructWithAdapter, + "module.UnionWithAdapter": premadeThriftType_module_UnionWithAdapter, + "module.MyI32_4873": premadeThriftType_module_MyI32_4873, + "module.StringWithAdapter_7208": premadeThriftType_module_StringWithAdapter_7208, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.MyAnnotation"). @@ -1173,6 +1258,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/cpp/metadata.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/cpp/metadata.go index cf22fe0abc1..db548a91fa5 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/cpp/metadata.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/cpp/metadata.go @@ -107,6 +107,31 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "cpp.RefType": premadeThriftType_cpp_RefType, + "cpp.EnumUnderlyingType": premadeThriftType_cpp_EnumUnderlyingType, + "string": premadeThriftType_string, + "cpp.Type": premadeThriftType_cpp_Type, + "cpp.Ref": premadeThriftType_cpp_Ref, + "cpp.Name": premadeThriftType_cpp_Name, + "bool": premadeThriftType_bool, + "cpp.Lazy": premadeThriftType_cpp_Lazy, + "cpp.DisableLazyChecksum": premadeThriftType_cpp_DisableLazyChecksum, + "cpp.Adapter": premadeThriftType_cpp_Adapter, + "cpp.PackIsset": premadeThriftType_cpp_PackIsset, + "cpp.MinimizePadding": premadeThriftType_cpp_MinimizePadding, + "cpp.ScopedEnumAsUnionType": premadeThriftType_cpp_ScopedEnumAsUnionType, + "cpp.FieldInterceptor": premadeThriftType_cpp_FieldInterceptor, + "cpp.UseOpEncode": premadeThriftType_cpp_UseOpEncode, + "cpp.EnumType": premadeThriftType_cpp_EnumType, + "cpp.Frozen2Exclude": premadeThriftType_cpp_Frozen2Exclude, + "cpp.Frozen2RequiresCompleteContainerParams": premadeThriftType_cpp_Frozen2RequiresCompleteContainerParams, + "cpp.ProcessInEbThreadUnsafe": premadeThriftType_cpp_ProcessInEbThreadUnsafe, + "cpp.RuntimeAnnotation": premadeThriftType_cpp_RuntimeAnnotation, + "cpp.UseCursorSerialization": premadeThriftType_cpp_UseCursorSerialization, + "cpp.GenerateDeprecatedHeaderClientMethods": premadeThriftType_cpp_GenerateDeprecatedHeaderClientMethods, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("cpp.Type"). @@ -295,6 +320,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/hack/metadata.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/hack/metadata.go index f1ac0716976..bdbf8156f6a 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/hack/metadata.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/hack/metadata.go @@ -68,6 +68,20 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "hack.FieldWrapper": premadeThriftType_hack_FieldWrapper, + "hack.Wrapper": premadeThriftType_hack_Wrapper, + "hack.Adapter": premadeThriftType_hack_Adapter, + "hack.SkipCodegen": premadeThriftType_hack_SkipCodegen, + "hack.Name": premadeThriftType_hack_Name, + "hack.UnionEnumAttributes": premadeThriftType_hack_UnionEnumAttributes, + "hack.StructTrait": premadeThriftType_hack_StructTrait, + "hack.Attributes": premadeThriftType_hack_Attributes, + "hack.StructAsTrait": premadeThriftType_hack_StructAsTrait, + "hack.ModuleInternal": premadeThriftType_hack_ModuleInternal, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("hack.FieldWrapper"). @@ -197,6 +211,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/python/metadata.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/python/metadata.go index 832a3ec13d8..67a17c2b56f 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/python/metadata.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/python/metadata.go @@ -51,6 +51,17 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "python.Py3Hidden": premadeThriftType_python_Py3Hidden, + "string": premadeThriftType_string, + "python.PyDeprecatedHidden": premadeThriftType_python_PyDeprecatedHidden, + "python.Flags": premadeThriftType_python_Flags, + "python.Name": premadeThriftType_python_Name, + "python.Adapter": premadeThriftType_python_Adapter, + "bool": premadeThriftType_bool, + "python.UseCAPI": premadeThriftType_python_UseCAPI, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("python.Py3Hidden"). @@ -122,6 +133,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/rust/metadata.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/rust/metadata.go index a0e759b4b2d..31264a4d057 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/rust/metadata.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/rust/metadata.go @@ -87,6 +87,25 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "rust.Name": premadeThriftType_rust_Name, + "rust.Copy": premadeThriftType_rust_Copy, + "rust.RequestContext": premadeThriftType_rust_RequestContext, + "rust.Arc": premadeThriftType_rust_Arc, + "rust.Box": premadeThriftType_rust_Box, + "rust.Exhaustive": premadeThriftType_rust_Exhaustive, + "rust.Ord": premadeThriftType_rust_Ord, + "rust.NewType": premadeThriftType_rust_NewType, + "rust.Type": premadeThriftType_rust_Type, + "bool": premadeThriftType_bool, + "rust.Serde": premadeThriftType_rust_Serde, + "rust.Mod": premadeThriftType_rust_Mod, + "rust.Adapter": premadeThriftType_rust_Adapter, + "rust.Derive": premadeThriftType_rust_Derive, + "rust.ServiceExn": premadeThriftType_rust_ServiceExn, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("rust.Name"). @@ -204,6 +223,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/scope/metadata.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/scope/metadata.go index 3de904bdcd8..e88c87e625e 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -89,6 +89,26 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "scope.Transitive": premadeThriftType_scope_Transitive, + "scope.Program": premadeThriftType_scope_Program, + "scope.Struct": premadeThriftType_scope_Struct, + "scope.Union": premadeThriftType_scope_Union, + "scope.Exception": premadeThriftType_scope_Exception, + "scope.Field": premadeThriftType_scope_Field, + "scope.Typedef": premadeThriftType_scope_Typedef, + "scope.Service": premadeThriftType_scope_Service, + "scope.Interaction": premadeThriftType_scope_Interaction, + "scope.Function": premadeThriftType_scope_Function, + "scope.EnumValue": premadeThriftType_scope_EnumValue, + "scope.Const": premadeThriftType_scope_Const, + "scope.Enum": premadeThriftType_scope_Enum, + "scope.Structured": premadeThriftType_scope_Structured, + "scope.Interface": premadeThriftType_scope_Interface, + "scope.RootDefinition": premadeThriftType_scope_RootDefinition, + "scope.Definition": premadeThriftType_scope_Definition, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("scope.Transitive"). @@ -152,6 +172,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/thrift/metadata.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/thrift/metadata.go index 96afd56c4fd..b87a254dd58 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -112,6 +112,29 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "thrift.RpcPriority": premadeThriftType_thrift_RpcPriority, + "thrift.Experimental": premadeThriftType_thrift_Experimental, + "i32": premadeThriftType_i32, + "thrift.ReserveIds": premadeThriftType_thrift_ReserveIds, + "bool": premadeThriftType_bool, + "thrift.RequiresBackwardCompatibility": premadeThriftType_thrift_RequiresBackwardCompatibility, + "thrift.TerseWrite": premadeThriftType_thrift_TerseWrite, + "thrift.Box": premadeThriftType_thrift_Box, + "thrift.Mixin": premadeThriftType_thrift_Mixin, + "thrift.SerializeInFieldIdOrder": premadeThriftType_thrift_SerializeInFieldIdOrder, + "thrift.BitmaskEnum": premadeThriftType_thrift_BitmaskEnum, + "thrift.ExceptionMessage": premadeThriftType_thrift_ExceptionMessage, + "thrift.InternBox": premadeThriftType_thrift_InternBox, + "thrift.Serial": premadeThriftType_thrift_Serial, + "string": premadeThriftType_string, + "thrift.Uri": premadeThriftType_thrift_Uri, + "thrift.Priority": premadeThriftType_thrift_Priority, + "thrift.DeprecatedUnvalidatedAnnotations": premadeThriftType_thrift_DeprecatedUnvalidatedAnnotations, + "thrift.AllowReservedIdentifier": premadeThriftType_thrift_AllowReservedIdentifier, + "thrift.AllowReservedFilename": premadeThriftType_thrift_AllowReservedFilename, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("thrift.Experimental"). @@ -233,6 +256,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/metadata.go index d41306c932f..8f687eacc41 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/metadata.go @@ -79,6 +79,23 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "module.MyEnum": premadeThriftType_module_MyEnum, + "string": premadeThriftType_string, + "module.MyStructNestedAnnotation": premadeThriftType_module_MyStructNestedAnnotation, + "module.MyUnion": premadeThriftType_module_MyUnion, + "i64": premadeThriftType_i64, + "module.list_string_6884": premadeThriftType_module_list_string_6884, + "module.MyStruct": premadeThriftType_module_MyStruct, + "module.SecretStruct": premadeThriftType_module_SecretStruct, + "module.MyException": premadeThriftType_module_MyException, + "module.AwesomeStruct": premadeThriftType_module_AwesomeStruct, + "module.FantasticStruct": premadeThriftType_module_FantasticStruct, + "void": premadeThriftType_void, + "bool": premadeThriftType_bool, + "i32": premadeThriftType_i32, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.MyStructNestedAnnotation"). @@ -328,6 +345,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/cpp/metadata.go b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/cpp/metadata.go index cf22fe0abc1..db548a91fa5 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/cpp/metadata.go +++ b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/cpp/metadata.go @@ -107,6 +107,31 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "cpp.RefType": premadeThriftType_cpp_RefType, + "cpp.EnumUnderlyingType": premadeThriftType_cpp_EnumUnderlyingType, + "string": premadeThriftType_string, + "cpp.Type": premadeThriftType_cpp_Type, + "cpp.Ref": premadeThriftType_cpp_Ref, + "cpp.Name": premadeThriftType_cpp_Name, + "bool": premadeThriftType_bool, + "cpp.Lazy": premadeThriftType_cpp_Lazy, + "cpp.DisableLazyChecksum": premadeThriftType_cpp_DisableLazyChecksum, + "cpp.Adapter": premadeThriftType_cpp_Adapter, + "cpp.PackIsset": premadeThriftType_cpp_PackIsset, + "cpp.MinimizePadding": premadeThriftType_cpp_MinimizePadding, + "cpp.ScopedEnumAsUnionType": premadeThriftType_cpp_ScopedEnumAsUnionType, + "cpp.FieldInterceptor": premadeThriftType_cpp_FieldInterceptor, + "cpp.UseOpEncode": premadeThriftType_cpp_UseOpEncode, + "cpp.EnumType": premadeThriftType_cpp_EnumType, + "cpp.Frozen2Exclude": premadeThriftType_cpp_Frozen2Exclude, + "cpp.Frozen2RequiresCompleteContainerParams": premadeThriftType_cpp_Frozen2RequiresCompleteContainerParams, + "cpp.ProcessInEbThreadUnsafe": premadeThriftType_cpp_ProcessInEbThreadUnsafe, + "cpp.RuntimeAnnotation": premadeThriftType_cpp_RuntimeAnnotation, + "cpp.UseCursorSerialization": premadeThriftType_cpp_UseCursorSerialization, + "cpp.GenerateDeprecatedHeaderClientMethods": premadeThriftType_cpp_GenerateDeprecatedHeaderClientMethods, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("cpp.Type"). @@ -295,6 +320,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/go/metadata.go b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/go/metadata.go index 5a628ec977c..6862fbabfaf 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/go/metadata.go +++ b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/go/metadata.go @@ -32,6 +32,12 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "go.Name": premadeThriftType_go_Name, + "go.Tag": premadeThriftType_go_Tag, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("go.Name"). @@ -68,6 +74,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/hack/metadata.go b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/hack/metadata.go index f1ac0716976..bdbf8156f6a 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/hack/metadata.go +++ b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/hack/metadata.go @@ -68,6 +68,20 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "hack.FieldWrapper": premadeThriftType_hack_FieldWrapper, + "hack.Wrapper": premadeThriftType_hack_Wrapper, + "hack.Adapter": premadeThriftType_hack_Adapter, + "hack.SkipCodegen": premadeThriftType_hack_SkipCodegen, + "hack.Name": premadeThriftType_hack_Name, + "hack.UnionEnumAttributes": premadeThriftType_hack_UnionEnumAttributes, + "hack.StructTrait": premadeThriftType_hack_StructTrait, + "hack.Attributes": premadeThriftType_hack_Attributes, + "hack.StructAsTrait": premadeThriftType_hack_StructAsTrait, + "hack.ModuleInternal": premadeThriftType_hack_ModuleInternal, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("hack.FieldWrapper"). @@ -197,6 +211,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/scope/metadata.go b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/scope/metadata.go index 3de904bdcd8..e88c87e625e 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -89,6 +89,26 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "scope.Transitive": premadeThriftType_scope_Transitive, + "scope.Program": premadeThriftType_scope_Program, + "scope.Struct": premadeThriftType_scope_Struct, + "scope.Union": premadeThriftType_scope_Union, + "scope.Exception": premadeThriftType_scope_Exception, + "scope.Field": premadeThriftType_scope_Field, + "scope.Typedef": premadeThriftType_scope_Typedef, + "scope.Service": premadeThriftType_scope_Service, + "scope.Interaction": premadeThriftType_scope_Interaction, + "scope.Function": premadeThriftType_scope_Function, + "scope.EnumValue": premadeThriftType_scope_EnumValue, + "scope.Const": premadeThriftType_scope_Const, + "scope.Enum": premadeThriftType_scope_Enum, + "scope.Structured": premadeThriftType_scope_Structured, + "scope.Interface": premadeThriftType_scope_Interface, + "scope.RootDefinition": premadeThriftType_scope_RootDefinition, + "scope.Definition": premadeThriftType_scope_Definition, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("scope.Transitive"). @@ -152,6 +172,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/thrift/metadata.go b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/thrift/metadata.go index 96afd56c4fd..b87a254dd58 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -112,6 +112,29 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "thrift.RpcPriority": premadeThriftType_thrift_RpcPriority, + "thrift.Experimental": premadeThriftType_thrift_Experimental, + "i32": premadeThriftType_i32, + "thrift.ReserveIds": premadeThriftType_thrift_ReserveIds, + "bool": premadeThriftType_bool, + "thrift.RequiresBackwardCompatibility": premadeThriftType_thrift_RequiresBackwardCompatibility, + "thrift.TerseWrite": premadeThriftType_thrift_TerseWrite, + "thrift.Box": premadeThriftType_thrift_Box, + "thrift.Mixin": premadeThriftType_thrift_Mixin, + "thrift.SerializeInFieldIdOrder": premadeThriftType_thrift_SerializeInFieldIdOrder, + "thrift.BitmaskEnum": premadeThriftType_thrift_BitmaskEnum, + "thrift.ExceptionMessage": premadeThriftType_thrift_ExceptionMessage, + "thrift.InternBox": premadeThriftType_thrift_InternBox, + "thrift.Serial": premadeThriftType_thrift_Serial, + "string": premadeThriftType_string, + "thrift.Uri": premadeThriftType_thrift_Uri, + "thrift.Priority": premadeThriftType_thrift_Priority, + "thrift.DeprecatedUnvalidatedAnnotations": premadeThriftType_thrift_DeprecatedUnvalidatedAnnotations, + "thrift.AllowReservedIdentifier": premadeThriftType_thrift_AllowReservedIdentifier, + "thrift.AllowReservedFilename": premadeThriftType_thrift_AllowReservedFilename, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("thrift.Experimental"). @@ -233,6 +256,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/metadata.go index 2daed70a0d2..c6531578511 100644 --- a/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/metadata.go @@ -109,6 +109,28 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "module.MyEnum": premadeThriftType_module_MyEnum, + "module.HackEnum": premadeThriftType_module_HackEnum, + "i64": premadeThriftType_i64, + "string": premadeThriftType_string, + "module.MyDataItem": premadeThriftType_module_MyDataItem, + "module.MyDataItemAlias": premadeThriftType_module_MyDataItemAlias, + "bool": premadeThriftType_bool, + "float": premadeThriftType_float, + "module.MyStruct": premadeThriftType_module_MyStruct, + "i32": premadeThriftType_i32, + "module.Containers": premadeThriftType_module_Containers, + "module.MyEnumAlias": premadeThriftType_module_MyEnumAlias, + "module.MyUnion": premadeThriftType_module_MyUnion, + "module.ReservedKeyword": premadeThriftType_module_ReservedKeyword, + "module.UnionToBeRenamed": premadeThriftType_module_UnionToBeRenamed, + "module.MyException": premadeThriftType_module_MyException, + "module.MyExceptionWithMessage": premadeThriftType_module_MyExceptionWithMessage, + "void": premadeThriftType_void, + "binary": premadeThriftType_binary, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.MyStruct"). @@ -488,6 +510,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/hack/metadata.go b/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/hack/metadata.go index f1ac0716976..bdbf8156f6a 100644 --- a/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/hack/metadata.go +++ b/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/hack/metadata.go @@ -68,6 +68,20 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "hack.FieldWrapper": premadeThriftType_hack_FieldWrapper, + "hack.Wrapper": premadeThriftType_hack_Wrapper, + "hack.Adapter": premadeThriftType_hack_Adapter, + "hack.SkipCodegen": premadeThriftType_hack_SkipCodegen, + "hack.Name": premadeThriftType_hack_Name, + "hack.UnionEnumAttributes": premadeThriftType_hack_UnionEnumAttributes, + "hack.StructTrait": premadeThriftType_hack_StructTrait, + "hack.Attributes": premadeThriftType_hack_Attributes, + "hack.StructAsTrait": premadeThriftType_hack_StructAsTrait, + "hack.ModuleInternal": premadeThriftType_hack_ModuleInternal, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("hack.FieldWrapper"). @@ -197,6 +211,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/scope/metadata.go b/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/scope/metadata.go index 3de904bdcd8..e88c87e625e 100644 --- a/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -89,6 +89,26 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "scope.Transitive": premadeThriftType_scope_Transitive, + "scope.Program": premadeThriftType_scope_Program, + "scope.Struct": premadeThriftType_scope_Struct, + "scope.Union": premadeThriftType_scope_Union, + "scope.Exception": premadeThriftType_scope_Exception, + "scope.Field": premadeThriftType_scope_Field, + "scope.Typedef": premadeThriftType_scope_Typedef, + "scope.Service": premadeThriftType_scope_Service, + "scope.Interaction": premadeThriftType_scope_Interaction, + "scope.Function": premadeThriftType_scope_Function, + "scope.EnumValue": premadeThriftType_scope_EnumValue, + "scope.Const": premadeThriftType_scope_Const, + "scope.Enum": premadeThriftType_scope_Enum, + "scope.Structured": premadeThriftType_scope_Structured, + "scope.Interface": premadeThriftType_scope_Interface, + "scope.RootDefinition": premadeThriftType_scope_RootDefinition, + "scope.Definition": premadeThriftType_scope_Definition, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("scope.Transitive"). @@ -152,6 +172,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/thrift/metadata.go b/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/thrift/metadata.go index 96afd56c4fd..b87a254dd58 100644 --- a/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -112,6 +112,29 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "thrift.RpcPriority": premadeThriftType_thrift_RpcPriority, + "thrift.Experimental": premadeThriftType_thrift_Experimental, + "i32": premadeThriftType_i32, + "thrift.ReserveIds": premadeThriftType_thrift_ReserveIds, + "bool": premadeThriftType_bool, + "thrift.RequiresBackwardCompatibility": premadeThriftType_thrift_RequiresBackwardCompatibility, + "thrift.TerseWrite": premadeThriftType_thrift_TerseWrite, + "thrift.Box": premadeThriftType_thrift_Box, + "thrift.Mixin": premadeThriftType_thrift_Mixin, + "thrift.SerializeInFieldIdOrder": premadeThriftType_thrift_SerializeInFieldIdOrder, + "thrift.BitmaskEnum": premadeThriftType_thrift_BitmaskEnum, + "thrift.ExceptionMessage": premadeThriftType_thrift_ExceptionMessage, + "thrift.InternBox": premadeThriftType_thrift_InternBox, + "thrift.Serial": premadeThriftType_thrift_Serial, + "string": premadeThriftType_string, + "thrift.Uri": premadeThriftType_thrift_Uri, + "thrift.Priority": premadeThriftType_thrift_Priority, + "thrift.DeprecatedUnvalidatedAnnotations": premadeThriftType_thrift_DeprecatedUnvalidatedAnnotations, + "thrift.AllowReservedIdentifier": premadeThriftType_thrift_AllowReservedIdentifier, + "thrift.AllowReservedFilename": premadeThriftType_thrift_AllowReservedFilename, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("thrift.Experimental"). @@ -233,6 +256,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/module/metadata.go index c4bc0bdf36e..1dedf3b720c 100644 --- a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/module/metadata.go @@ -86,6 +86,23 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i64": premadeThriftType_i64, + "string": premadeThriftType_string, + "i16": premadeThriftType_i16, + "module.containerTypedef": premadeThriftType_module_containerTypedef, + "module.ComplexUnion": premadeThriftType_module_ComplexUnion, + "module.ListUnion": premadeThriftType_module_ListUnion, + "binary": premadeThriftType_binary, + "module.DataUnion": premadeThriftType_module_DataUnion, + "i32": premadeThriftType_i32, + "module.Val": premadeThriftType_module_Val, + "module.ValUnion": premadeThriftType_module_ValUnion, + "module.VirtualComplexUnion": premadeThriftType_module_VirtualComplexUnion, + "module.NonCopyableStruct": premadeThriftType_module_NonCopyableStruct, + "module.NonCopyableUnion": premadeThriftType_module_NonCopyableUnion, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.ComplexUnion"). @@ -249,6 +266,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/cpp/metadata.go b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/cpp/metadata.go index cf22fe0abc1..db548a91fa5 100644 --- a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/cpp/metadata.go +++ b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/cpp/metadata.go @@ -107,6 +107,31 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "cpp.RefType": premadeThriftType_cpp_RefType, + "cpp.EnumUnderlyingType": premadeThriftType_cpp_EnumUnderlyingType, + "string": premadeThriftType_string, + "cpp.Type": premadeThriftType_cpp_Type, + "cpp.Ref": premadeThriftType_cpp_Ref, + "cpp.Name": premadeThriftType_cpp_Name, + "bool": premadeThriftType_bool, + "cpp.Lazy": premadeThriftType_cpp_Lazy, + "cpp.DisableLazyChecksum": premadeThriftType_cpp_DisableLazyChecksum, + "cpp.Adapter": premadeThriftType_cpp_Adapter, + "cpp.PackIsset": premadeThriftType_cpp_PackIsset, + "cpp.MinimizePadding": premadeThriftType_cpp_MinimizePadding, + "cpp.ScopedEnumAsUnionType": premadeThriftType_cpp_ScopedEnumAsUnionType, + "cpp.FieldInterceptor": premadeThriftType_cpp_FieldInterceptor, + "cpp.UseOpEncode": premadeThriftType_cpp_UseOpEncode, + "cpp.EnumType": premadeThriftType_cpp_EnumType, + "cpp.Frozen2Exclude": premadeThriftType_cpp_Frozen2Exclude, + "cpp.Frozen2RequiresCompleteContainerParams": premadeThriftType_cpp_Frozen2RequiresCompleteContainerParams, + "cpp.ProcessInEbThreadUnsafe": premadeThriftType_cpp_ProcessInEbThreadUnsafe, + "cpp.RuntimeAnnotation": premadeThriftType_cpp_RuntimeAnnotation, + "cpp.UseCursorSerialization": premadeThriftType_cpp_UseCursorSerialization, + "cpp.GenerateDeprecatedHeaderClientMethods": premadeThriftType_cpp_GenerateDeprecatedHeaderClientMethods, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("cpp.Type"). @@ -295,6 +320,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/scope/metadata.go b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/scope/metadata.go index 3de904bdcd8..e88c87e625e 100644 --- a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -89,6 +89,26 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "scope.Transitive": premadeThriftType_scope_Transitive, + "scope.Program": premadeThriftType_scope_Program, + "scope.Struct": premadeThriftType_scope_Struct, + "scope.Union": premadeThriftType_scope_Union, + "scope.Exception": premadeThriftType_scope_Exception, + "scope.Field": premadeThriftType_scope_Field, + "scope.Typedef": premadeThriftType_scope_Typedef, + "scope.Service": premadeThriftType_scope_Service, + "scope.Interaction": premadeThriftType_scope_Interaction, + "scope.Function": premadeThriftType_scope_Function, + "scope.EnumValue": premadeThriftType_scope_EnumValue, + "scope.Const": premadeThriftType_scope_Const, + "scope.Enum": premadeThriftType_scope_Enum, + "scope.Structured": premadeThriftType_scope_Structured, + "scope.Interface": premadeThriftType_scope_Interface, + "scope.RootDefinition": premadeThriftType_scope_RootDefinition, + "scope.Definition": premadeThriftType_scope_Definition, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("scope.Transitive"). @@ -152,6 +172,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/thrift/metadata.go b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/thrift/metadata.go index 96afd56c4fd..b87a254dd58 100644 --- a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -112,6 +112,29 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "thrift.RpcPriority": premadeThriftType_thrift_RpcPriority, + "thrift.Experimental": premadeThriftType_thrift_Experimental, + "i32": premadeThriftType_i32, + "thrift.ReserveIds": premadeThriftType_thrift_ReserveIds, + "bool": premadeThriftType_bool, + "thrift.RequiresBackwardCompatibility": premadeThriftType_thrift_RequiresBackwardCompatibility, + "thrift.TerseWrite": premadeThriftType_thrift_TerseWrite, + "thrift.Box": premadeThriftType_thrift_Box, + "thrift.Mixin": premadeThriftType_thrift_Mixin, + "thrift.SerializeInFieldIdOrder": premadeThriftType_thrift_SerializeInFieldIdOrder, + "thrift.BitmaskEnum": premadeThriftType_thrift_BitmaskEnum, + "thrift.ExceptionMessage": premadeThriftType_thrift_ExceptionMessage, + "thrift.InternBox": premadeThriftType_thrift_InternBox, + "thrift.Serial": premadeThriftType_thrift_Serial, + "string": premadeThriftType_string, + "thrift.Uri": premadeThriftType_thrift_Uri, + "thrift.Priority": premadeThriftType_thrift_Priority, + "thrift.DeprecatedUnvalidatedAnnotations": premadeThriftType_thrift_DeprecatedUnvalidatedAnnotations, + "thrift.AllowReservedIdentifier": premadeThriftType_thrift_AllowReservedIdentifier, + "thrift.AllowReservedFilename": premadeThriftType_thrift_AllowReservedFilename, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("thrift.Experimental"). @@ -233,6 +256,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/constants/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/constants/out/go/gen-go/module/metadata.go index 3e61b127739..0ba30e5caec 100644 --- a/thrift/compiler/test/fixtures/constants/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/constants/out/go/gen-go/module/metadata.go @@ -106,6 +106,28 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "module.EmptyEnum": premadeThriftType_module_EmptyEnum, + "module.City": premadeThriftType_module_City, + "module.Company": premadeThriftType_module_Company, + "i32": premadeThriftType_i32, + "string": premadeThriftType_string, + "double": premadeThriftType_double, + "module.Internship": premadeThriftType_module_Internship, + "module.Range": premadeThriftType_module_Range, + "module.struct1": premadeThriftType_module_struct1, + "module.struct2": premadeThriftType_module_struct2, + "module.struct3": premadeThriftType_module_struct3, + "byte": premadeThriftType_byte, + "module.struct4": premadeThriftType_module_struct4, + "module.union1": premadeThriftType_module_union1, + "module.union2": premadeThriftType_module_union2, + "module.MyCompany": premadeThriftType_module_MyCompany, + "module.MyStringIdentifier": premadeThriftType_module_MyStringIdentifier, + "module.MyIntIdentifier": premadeThriftType_module_MyIntIdentifier, + "module.MyMapIdentifier": premadeThriftType_module_MyMapIdentifier, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.Internship"). @@ -325,6 +347,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/default_values/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/default_values/out/go/gen-go/module/metadata.go index 8a51eaf551c..ceb95db67c2 100644 --- a/thrift/compiler/test/fixtures/default_values/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/default_values/out/go/gen-go/module/metadata.go @@ -36,6 +36,13 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i32": premadeThriftType_i32, + "module.TrivialStruct": premadeThriftType_module_TrivialStruct, + "module.StructWithNoCustomDefaultValues": premadeThriftType_module_StructWithNoCustomDefaultValues, + "module.StructWithCustomDefaultValues": premadeThriftType_module_StructWithCustomDefaultValues, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.TrivialStruct"). @@ -134,6 +141,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/metadata.go index 21a2634de34..b28434070a7 100644 --- a/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/metadata.go @@ -60,6 +60,18 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "module.B": premadeThriftType_module_B, + "i32": premadeThriftType_i32, + "module.A": premadeThriftType_module_A, + "string": premadeThriftType_string, + "module.U": premadeThriftType_module_U, + "module.Bang": premadeThriftType_module_Bang, + "module.lanyard": premadeThriftType_module_lanyard, + "module.number": premadeThriftType_module_number, + "void": premadeThriftType_void, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.A"). @@ -161,6 +173,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/empty-struct/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/empty-struct/out/go/gen-go/module/metadata.go index bf909fd3954..2ff881a6f17 100644 --- a/thrift/compiler/test/fixtures/empty-struct/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/empty-struct/out/go/gen-go/module/metadata.go @@ -29,6 +29,11 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "module.Empty": premadeThriftType_module_Empty, + "module.Nada": premadeThriftType_module_Nada, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.Empty"). @@ -47,6 +52,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/enums/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/enums/out/go/gen-go/module/metadata.go index 308819e140b..799e40e5350 100644 --- a/thrift/compiler/test/fixtures/enums/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/enums/out/go/gen-go/module/metadata.go @@ -64,6 +64,19 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "module.Metasyntactic": premadeThriftType_module_Metasyntactic, + "module.MyEnum1": premadeThriftType_module_MyEnum1, + "module.MyEnum2": premadeThriftType_module_MyEnum2, + "module.MyEnum3": premadeThriftType_module_MyEnum3, + "module.MyEnum4": premadeThriftType_module_MyEnum4, + "module.MyBitmaskEnum1": premadeThriftType_module_MyBitmaskEnum1, + "module.MyBitmaskEnum2": premadeThriftType_module_MyBitmaskEnum2, + "i32": premadeThriftType_i32, + "module.SomeStruct": premadeThriftType_module_SomeStruct, + "module.MyStruct": premadeThriftType_module_MyStruct, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.SomeStruct"). @@ -201,6 +214,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/scope/metadata.go b/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/scope/metadata.go index 3de904bdcd8..e88c87e625e 100644 --- a/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -89,6 +89,26 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "scope.Transitive": premadeThriftType_scope_Transitive, + "scope.Program": premadeThriftType_scope_Program, + "scope.Struct": premadeThriftType_scope_Struct, + "scope.Union": premadeThriftType_scope_Union, + "scope.Exception": premadeThriftType_scope_Exception, + "scope.Field": premadeThriftType_scope_Field, + "scope.Typedef": premadeThriftType_scope_Typedef, + "scope.Service": premadeThriftType_scope_Service, + "scope.Interaction": premadeThriftType_scope_Interaction, + "scope.Function": premadeThriftType_scope_Function, + "scope.EnumValue": premadeThriftType_scope_EnumValue, + "scope.Const": premadeThriftType_scope_Const, + "scope.Enum": premadeThriftType_scope_Enum, + "scope.Structured": premadeThriftType_scope_Structured, + "scope.Interface": premadeThriftType_scope_Interface, + "scope.RootDefinition": premadeThriftType_scope_RootDefinition, + "scope.Definition": premadeThriftType_scope_Definition, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("scope.Transitive"). @@ -152,6 +172,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/thrift/metadata.go b/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/thrift/metadata.go index 96afd56c4fd..b87a254dd58 100644 --- a/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -112,6 +112,29 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "thrift.RpcPriority": premadeThriftType_thrift_RpcPriority, + "thrift.Experimental": premadeThriftType_thrift_Experimental, + "i32": premadeThriftType_i32, + "thrift.ReserveIds": premadeThriftType_thrift_ReserveIds, + "bool": premadeThriftType_bool, + "thrift.RequiresBackwardCompatibility": premadeThriftType_thrift_RequiresBackwardCompatibility, + "thrift.TerseWrite": premadeThriftType_thrift_TerseWrite, + "thrift.Box": premadeThriftType_thrift_Box, + "thrift.Mixin": premadeThriftType_thrift_Mixin, + "thrift.SerializeInFieldIdOrder": premadeThriftType_thrift_SerializeInFieldIdOrder, + "thrift.BitmaskEnum": premadeThriftType_thrift_BitmaskEnum, + "thrift.ExceptionMessage": premadeThriftType_thrift_ExceptionMessage, + "thrift.InternBox": premadeThriftType_thrift_InternBox, + "thrift.Serial": premadeThriftType_thrift_Serial, + "string": premadeThriftType_string, + "thrift.Uri": premadeThriftType_thrift_Uri, + "thrift.Priority": premadeThriftType_thrift_Priority, + "thrift.DeprecatedUnvalidatedAnnotations": premadeThriftType_thrift_DeprecatedUnvalidatedAnnotations, + "thrift.AllowReservedIdentifier": premadeThriftType_thrift_AllowReservedIdentifier, + "thrift.AllowReservedFilename": premadeThriftType_thrift_AllowReservedFilename, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("thrift.Experimental"). @@ -233,6 +256,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/metadata.go index d806d52e0a8..f99d5145221 100644 --- a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/metadata.go @@ -58,6 +58,19 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "module.Fiery": premadeThriftType_module_Fiery, + "module.Serious": premadeThriftType_module_Serious, + "module.ComplexFieldNames": premadeThriftType_module_ComplexFieldNames, + "module.CustomFieldNames": premadeThriftType_module_CustomFieldNames, + "i32": premadeThriftType_i32, + "module.ExceptionWithPrimitiveField": premadeThriftType_module_ExceptionWithPrimitiveField, + "module.ExceptionWithStructuredAnnotation": premadeThriftType_module_ExceptionWithStructuredAnnotation, + "module.Banal": premadeThriftType_module_Banal, + "void": premadeThriftType_void, +} + var structMetadatas = []*metadata.ThriftStruct{ } @@ -218,6 +231,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/python/metadata.go b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/python/metadata.go index 832a3ec13d8..67a17c2b56f 100644 --- a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/python/metadata.go +++ b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/python/metadata.go @@ -51,6 +51,17 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "python.Py3Hidden": premadeThriftType_python_Py3Hidden, + "string": premadeThriftType_string, + "python.PyDeprecatedHidden": premadeThriftType_python_PyDeprecatedHidden, + "python.Flags": premadeThriftType_python_Flags, + "python.Name": premadeThriftType_python_Name, + "python.Adapter": premadeThriftType_python_Adapter, + "bool": premadeThriftType_bool, + "python.UseCAPI": premadeThriftType_python_UseCAPI, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("python.Py3Hidden"). @@ -122,6 +133,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/scope/metadata.go b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/scope/metadata.go index 3de904bdcd8..e88c87e625e 100644 --- a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -89,6 +89,26 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "scope.Transitive": premadeThriftType_scope_Transitive, + "scope.Program": premadeThriftType_scope_Program, + "scope.Struct": premadeThriftType_scope_Struct, + "scope.Union": premadeThriftType_scope_Union, + "scope.Exception": premadeThriftType_scope_Exception, + "scope.Field": premadeThriftType_scope_Field, + "scope.Typedef": premadeThriftType_scope_Typedef, + "scope.Service": premadeThriftType_scope_Service, + "scope.Interaction": premadeThriftType_scope_Interaction, + "scope.Function": premadeThriftType_scope_Function, + "scope.EnumValue": premadeThriftType_scope_EnumValue, + "scope.Const": premadeThriftType_scope_Const, + "scope.Enum": premadeThriftType_scope_Enum, + "scope.Structured": premadeThriftType_scope_Structured, + "scope.Interface": premadeThriftType_scope_Interface, + "scope.RootDefinition": premadeThriftType_scope_RootDefinition, + "scope.Definition": premadeThriftType_scope_Definition, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("scope.Transitive"). @@ -152,6 +172,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/thrift/metadata.go b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/thrift/metadata.go index 96afd56c4fd..b87a254dd58 100644 --- a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -112,6 +112,29 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "thrift.RpcPriority": premadeThriftType_thrift_RpcPriority, + "thrift.Experimental": premadeThriftType_thrift_Experimental, + "i32": premadeThriftType_i32, + "thrift.ReserveIds": premadeThriftType_thrift_ReserveIds, + "bool": premadeThriftType_bool, + "thrift.RequiresBackwardCompatibility": premadeThriftType_thrift_RequiresBackwardCompatibility, + "thrift.TerseWrite": premadeThriftType_thrift_TerseWrite, + "thrift.Box": premadeThriftType_thrift_Box, + "thrift.Mixin": premadeThriftType_thrift_Mixin, + "thrift.SerializeInFieldIdOrder": premadeThriftType_thrift_SerializeInFieldIdOrder, + "thrift.BitmaskEnum": premadeThriftType_thrift_BitmaskEnum, + "thrift.ExceptionMessage": premadeThriftType_thrift_ExceptionMessage, + "thrift.InternBox": premadeThriftType_thrift_InternBox, + "thrift.Serial": premadeThriftType_thrift_Serial, + "string": premadeThriftType_string, + "thrift.Uri": premadeThriftType_thrift_Uri, + "thrift.Priority": premadeThriftType_thrift_Priority, + "thrift.DeprecatedUnvalidatedAnnotations": premadeThriftType_thrift_DeprecatedUnvalidatedAnnotations, + "thrift.AllowReservedIdentifier": premadeThriftType_thrift_AllowReservedIdentifier, + "thrift.AllowReservedFilename": premadeThriftType_thrift_AllowReservedFilename, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("thrift.Experimental"). @@ -233,6 +256,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/metadata.go index 4ab01bea862..e4dc7e7c8e0 100644 --- a/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/metadata.go @@ -75,6 +75,20 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "module.GetEntityRequest": premadeThriftType_module_GetEntityRequest, + "module.GetEntityResponse": premadeThriftType_module_GetEntityResponse, + "module.NonComparableStruct": premadeThriftType_module_NonComparableStruct, + "i64": premadeThriftType_i64, + "bool": premadeThriftType_bool, + "byte": premadeThriftType_byte, + "i16": premadeThriftType_i16, + "i32": premadeThriftType_i32, + "double": premadeThriftType_double, + "binary": premadeThriftType_binary, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.GetEntityRequest"). @@ -356,6 +370,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module0/gen-go/module0/metadata.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module0/gen-go/module0/metadata.go index e40e896b7f2..3c10342bd47 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module0/gen-go/module0/metadata.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module0/gen-go/module0/metadata.go @@ -35,6 +35,13 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i32": premadeThriftType_i32, + "string": premadeThriftType_string, + "module0.Accessory": premadeThriftType_module0_Accessory, + "module0.PartName": premadeThriftType_module0_PartName, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module0.Accessory"). @@ -81,6 +88,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module0/metadata.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module0/metadata.go index 3258cdad4b3..d2b88ca68ed 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module0/metadata.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module0/metadata.go @@ -35,6 +35,13 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i32": premadeThriftType_i32, + "string": premadeThriftType_string, + "module0.Accessory": premadeThriftType_module0_Accessory, + "module0.PartName": premadeThriftType_module0_PartName, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module0.Accessory"). @@ -81,6 +88,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/metadata.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/metadata.go index d37feb5bb17..b10cc96b68e 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/metadata.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/metadata.go @@ -48,27 +48,19 @@ var ( SetName("module1.Drivers"). SetUnderlyingType(premadeThriftType_list_string), ) - premadeThriftType_module0_Accessory = metadata.NewThriftType().SetTStruct( - metadata.NewThriftStructType(). - SetName("module0.Accessory"), - ) premadeThriftType_module1_Accessory = metadata.NewThriftType().SetTTypedef( metadata.NewThriftTypedefType(). SetName("module1.Accessory"). - SetUnderlyingType(premadeThriftType_module0_Accessory), + SetUnderlyingType(module0.GetMetadataThriftType("module0.Accessory")), ) premadeThriftType_list_module1_Accessory = metadata.NewThriftType().SetTList( metadata.NewThriftListType(). SetValueType(premadeThriftType_module1_Accessory), ) - premadeThriftType_module0_PartName = metadata.NewThriftType().SetTStruct( - metadata.NewThriftStructType(). - SetName("module0.PartName"), - ) premadeThriftType_module1_PartName = metadata.NewThriftType().SetTTypedef( metadata.NewThriftTypedefType(). SetName("module1.PartName"). - SetUnderlyingType(premadeThriftType_module0_PartName), + SetUnderlyingType(module0.GetMetadataThriftType("module0.PartName")), ) premadeThriftType_map_i32_module1_PartName = metadata.NewThriftType().SetTMap( metadata.NewThriftMapType(). @@ -121,17 +113,32 @@ var ( SetName("module1.State"). SetUnderlyingType(premadeThriftType_string), ) - premadeThriftType_module2_Enum = metadata.NewThriftType().SetTEnum( - metadata.NewThriftEnumType(). - SetName("module2.Enum"), - ) premadeThriftType_module1_Enum = metadata.NewThriftType().SetTTypedef( metadata.NewThriftTypedefType(). SetName("module1.Enum"). - SetUnderlyingType(premadeThriftType_module2_Enum), + SetUnderlyingType(module2.GetMetadataThriftType("module2.Enum")), ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "module1.Plate": premadeThriftType_module1_Plate, + "i32": premadeThriftType_i32, + "module1.Year": premadeThriftType_module1_Year, + "module1.Drivers": premadeThriftType_module1_Drivers, + "module1.Accessory": premadeThriftType_module1_Accessory, + "module1.PartName": premadeThriftType_module1_PartName, + "module1.Automobile": premadeThriftType_module1_Automobile, + "i64": premadeThriftType_i64, + "module1.MapKey": premadeThriftType_module1_MapKey, + "module1.MapContainer": premadeThriftType_module1_MapContainer, + "module1.Car": premadeThriftType_module1_Car, + "module1.Pair": premadeThriftType_module1_Pair, + "module1.Collection": premadeThriftType_module1_Collection, + "module1.State": premadeThriftType_module1_State, + "module1.Enum": premadeThriftType_module1_Enum, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module1.Automobile"). @@ -294,6 +301,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module2/metadata.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module2/metadata.go index aad69b3ce6e..c52cb067e30 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module2/metadata.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module2/metadata.go @@ -25,6 +25,10 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "module2.Enum": premadeThriftType_module2_Enum, +} + var structMetadatas = []*metadata.ThriftStruct{ } @@ -46,6 +50,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/go/metadata.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/go/metadata.go index 5a628ec977c..6862fbabfaf 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/go/metadata.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/go/metadata.go @@ -32,6 +32,12 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "go.Name": premadeThriftType_go_Name, + "go.Tag": premadeThriftType_go_Tag, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("go.Name"). @@ -68,6 +74,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/scope/metadata.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/scope/metadata.go index 3de904bdcd8..e88c87e625e 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/scope/metadata.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/scope/metadata.go @@ -89,6 +89,26 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "scope.Transitive": premadeThriftType_scope_Transitive, + "scope.Program": premadeThriftType_scope_Program, + "scope.Struct": premadeThriftType_scope_Struct, + "scope.Union": premadeThriftType_scope_Union, + "scope.Exception": premadeThriftType_scope_Exception, + "scope.Field": premadeThriftType_scope_Field, + "scope.Typedef": premadeThriftType_scope_Typedef, + "scope.Service": premadeThriftType_scope_Service, + "scope.Interaction": premadeThriftType_scope_Interaction, + "scope.Function": premadeThriftType_scope_Function, + "scope.EnumValue": premadeThriftType_scope_EnumValue, + "scope.Const": premadeThriftType_scope_Const, + "scope.Enum": premadeThriftType_scope_Enum, + "scope.Structured": premadeThriftType_scope_Structured, + "scope.Interface": premadeThriftType_scope_Interface, + "scope.RootDefinition": premadeThriftType_scope_RootDefinition, + "scope.Definition": premadeThriftType_scope_Definition, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("scope.Transitive"). @@ -152,6 +172,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module2/gen-go/module2/metadata.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module2/gen-go/module2/metadata.go index aa40fd5bd5b..9769c128ab3 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module2/gen-go/module2/metadata.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module2/gen-go/module2/metadata.go @@ -25,6 +25,10 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "module2.Enum": premadeThriftType_module2_Enum, +} + var structMetadatas = []*metadata.ThriftStruct{ } @@ -46,6 +50,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/IncludesAlso/metadata.go b/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/IncludesAlso/metadata.go index 21bf6681623..d0d91e93c68 100644 --- a/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/IncludesAlso/metadata.go +++ b/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/IncludesAlso/metadata.go @@ -25,6 +25,10 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "IncludesAlso.Also": premadeThriftType_IncludesAlso_Also, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("IncludesAlso.Also"). @@ -40,6 +44,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/matching_names/metadata.go b/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/matching_names/metadata.go index 4ca04c8db02..3a4b0a17321 100644 --- a/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/matching_names/metadata.go +++ b/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/matching_names/metadata.go @@ -21,16 +21,16 @@ var _ = metadata.GoUnusedProtection__ // Premade Thrift types var ( - premadeThriftType_IncludesAlso_Also = metadata.NewThriftType().SetTStruct( - metadata.NewThriftStructType(). - SetName("IncludesAlso.Also"), - ) premadeThriftType_matching_names_IncludesAlso = metadata.NewThriftType().SetTStruct( metadata.NewThriftStructType(). SetName("matching_names.IncludesAlso"), ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "matching_names.IncludesAlso": premadeThriftType_matching_names_IncludesAlso, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("matching_names.IncludesAlso"). @@ -41,7 +41,7 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(1). SetName("also"). SetIsOptional(false). - SetType(premadeThriftType_IncludesAlso_Also), + SetType(includesAlso.GetMetadataThriftType("IncludesAlso.Also")), }, ), } @@ -55,6 +55,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/includes/metadata.go b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/includes/metadata.go index ceee0c06726..19949cf08aa 100644 --- a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/includes/metadata.go +++ b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/includes/metadata.go @@ -24,10 +24,6 @@ var ( premadeThriftType_i64 = metadata.NewThriftType().SetTPrimitive( metadata.ThriftPrimitiveType_THRIFT_I64_TYPE.Ptr(), ) - premadeThriftType_transitive_Foo = metadata.NewThriftType().SetTStruct( - metadata.NewThriftStructType(). - SetName("transitive.Foo"), - ) premadeThriftType_includes_Included = metadata.NewThriftType().SetTStruct( metadata.NewThriftStructType(). SetName("includes.Included"), @@ -40,10 +36,17 @@ var ( premadeThriftType_includes_TransitiveFoo = metadata.NewThriftType().SetTTypedef( metadata.NewThriftTypedefType(). SetName("includes.TransitiveFoo"). - SetUnderlyingType(premadeThriftType_transitive_Foo), + SetUnderlyingType(transitive.GetMetadataThriftType("transitive.Foo")), ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i64": premadeThriftType_i64, + "includes.Included": premadeThriftType_includes_Included, + "includes.IncludedInt64": premadeThriftType_includes_IncludedInt64, + "includes.TransitiveFoo": premadeThriftType_includes_TransitiveFoo, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("includes.Included"). @@ -59,7 +62,7 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(2). SetName("MyTransitiveField"). SetIsOptional(false). - SetType(premadeThriftType_transitive_Foo), + SetType(transitive.GetMetadataThriftType("transitive.Foo")), }, ), } @@ -73,6 +76,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/module/metadata.go index b07bec51a3c..b8ae2c3571d 100644 --- a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/module/metadata.go @@ -21,24 +21,20 @@ var _ = metadata.GoUnusedProtection__ // Premade Thrift types var ( - premadeThriftType_includes_Included = metadata.NewThriftType().SetTStruct( - metadata.NewThriftStructType(). - SetName("includes.Included"), - ) premadeThriftType_i64 = metadata.NewThriftType().SetTPrimitive( metadata.ThriftPrimitiveType_THRIFT_I64_TYPE.Ptr(), ) - premadeThriftType_includes_IncludedInt64 = metadata.NewThriftType().SetTTypedef( - metadata.NewThriftTypedefType(). - SetName("includes.IncludedInt64"). - SetUnderlyingType(premadeThriftType_i64), - ) premadeThriftType_module_MyStruct = metadata.NewThriftType().SetTStruct( metadata.NewThriftStructType(). SetName("module.MyStruct"), ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i64": premadeThriftType_i64, + "module.MyStruct": premadeThriftType_module_MyStruct, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.MyStruct"). @@ -49,17 +45,17 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(1). SetName("MyIncludedField"). SetIsOptional(false). - SetType(premadeThriftType_includes_Included), + SetType(includes.GetMetadataThriftType("includes.Included")), metadata.NewThriftField(). SetId(2). SetName("MyOtherIncludedField"). SetIsOptional(false). - SetType(premadeThriftType_includes_Included), + SetType(includes.GetMetadataThriftType("includes.Included")), metadata.NewThriftField(). SetId(3). SetName("MyIncludedInt"). SetIsOptional(false). - SetType(premadeThriftType_includes_IncludedInt64), + SetType(includes.GetMetadataThriftType("includes.IncludedInt64")), }, ), } @@ -73,6 +69,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/metadata.go b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/metadata.go index 48dbf858c6c..241a2db716d 100644 --- a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/metadata.go +++ b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/metadata.go @@ -23,38 +23,27 @@ var _ = metadata.GoUnusedProtection__ // Premade Thrift types var ( - premadeThriftType_includes_Included = metadata.NewThriftType().SetTStruct( - metadata.NewThriftStructType(). - SetName("includes.Included"), - ) premadeThriftType_service_IncludesIncluded = metadata.NewThriftType().SetTTypedef( metadata.NewThriftTypedefType(). SetName("service.IncludesIncluded"). - SetUnderlyingType(premadeThriftType_includes_Included), - ) - premadeThriftType_transitive_Foo = metadata.NewThriftType().SetTStruct( - metadata.NewThriftStructType(). - SetName("transitive.Foo"), - ) - premadeThriftType_includes_TransitiveFoo = metadata.NewThriftType().SetTTypedef( - metadata.NewThriftTypedefType(). - SetName("includes.TransitiveFoo"). - SetUnderlyingType(premadeThriftType_transitive_Foo), + SetUnderlyingType(includes.GetMetadataThriftType("includes.Included")), ) premadeThriftType_service_IncludesTransitiveFoo = metadata.NewThriftType().SetTTypedef( metadata.NewThriftTypedefType(). SetName("service.IncludesTransitiveFoo"). - SetUnderlyingType(premadeThriftType_includes_TransitiveFoo), + SetUnderlyingType(includes.GetMetadataThriftType("includes.TransitiveFoo")), ) premadeThriftType_void = metadata.NewThriftType().SetTPrimitive( metadata.ThriftPrimitiveType_THRIFT_VOID_TYPE.Ptr(), ) - premadeThriftType_module_MyStruct = metadata.NewThriftType().SetTStruct( - metadata.NewThriftStructType(). - SetName("module.MyStruct"), - ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "service.IncludesIncluded": premadeThriftType_service_IncludesIncluded, + "service.IncludesTransitiveFoo": premadeThriftType_service_IncludesTransitiveFoo, + "void": premadeThriftType_void, +} + var structMetadatas = []*metadata.ThriftStruct{ } @@ -79,12 +68,12 @@ var serviceMetadatas = []*metadata.ThriftService{ SetId(1). SetName("s"). SetIsOptional(false). - SetType(premadeThriftType_module_MyStruct), + SetType(module.GetMetadataThriftType("module.MyStruct")), metadata.NewThriftField(). SetId(2). SetName("i"). SetIsOptional(false). - SetType(premadeThriftType_includes_Included), + SetType(includes.GetMetadataThriftType("includes.Included")), }, ), metadata.NewThriftFunction(). @@ -97,18 +86,24 @@ var serviceMetadatas = []*metadata.ThriftService{ SetId(1). SetName("s"). SetIsOptional(false). - SetType(premadeThriftType_module_MyStruct), + SetType(module.GetMetadataThriftType("module.MyStruct")), metadata.NewThriftField(). SetId(2). SetName("i"). SetIsOptional(false). - SetType(premadeThriftType_includes_Included), + SetType(includes.GetMetadataThriftType("includes.Included")), }, ), }, ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/transitive/metadata.go b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/transitive/metadata.go index 4347df8ca25..844b08dc72a 100644 --- a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/transitive/metadata.go +++ b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/transitive/metadata.go @@ -28,6 +28,11 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i64": premadeThriftType_i64, + "transitive.Foo": premadeThriftType_transitive_Foo, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("transitive.Foo"). @@ -52,6 +57,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/metadata.go index 455469880d3..a8816da2eef 100644 --- a/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/metadata.go @@ -24,6 +24,10 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "void": premadeThriftType_void, +} + var structMetadatas = []*metadata.ThriftStruct{ } @@ -68,6 +72,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/foo/metadata.go b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/foo/metadata.go index d3fc7f58a6a..e8c275be1a7 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/foo/metadata.go +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/foo/metadata.go @@ -28,6 +28,11 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "foo.Fields": premadeThriftType_foo_Fields, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("foo.Fields"). @@ -62,6 +67,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/module/metadata.go index 424a653a8a0..86420c26d3c 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/module/metadata.go @@ -42,6 +42,14 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "module.Fields": premadeThriftType_module_Fields, + "module.FieldsInjectedToEmptyStruct": premadeThriftType_module_FieldsInjectedToEmptyStruct, + "module.FieldsInjectedToStruct": premadeThriftType_module_FieldsInjectedToStruct, + "module.FieldsInjectedWithIncludedStruct": premadeThriftType_module_FieldsInjectedWithIncludedStruct, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.Fields"). @@ -122,6 +130,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/internals/metadata.go b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/internals/metadata.go index 9fbf685663b..5253dd8d6af 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/internals/metadata.go +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/internals/metadata.go @@ -28,6 +28,11 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "internal.InjectMetadataFields": premadeThriftType_internal_InjectMetadataFields, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("internal.InjectMetadataFields"). @@ -52,6 +57,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/scope/metadata.go b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/scope/metadata.go index 3de904bdcd8..e88c87e625e 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -89,6 +89,26 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "scope.Transitive": premadeThriftType_scope_Transitive, + "scope.Program": premadeThriftType_scope_Program, + "scope.Struct": premadeThriftType_scope_Struct, + "scope.Union": premadeThriftType_scope_Union, + "scope.Exception": premadeThriftType_scope_Exception, + "scope.Field": premadeThriftType_scope_Field, + "scope.Typedef": premadeThriftType_scope_Typedef, + "scope.Service": premadeThriftType_scope_Service, + "scope.Interaction": premadeThriftType_scope_Interaction, + "scope.Function": premadeThriftType_scope_Function, + "scope.EnumValue": premadeThriftType_scope_EnumValue, + "scope.Const": premadeThriftType_scope_Const, + "scope.Enum": premadeThriftType_scope_Enum, + "scope.Structured": premadeThriftType_scope_Structured, + "scope.Interface": premadeThriftType_scope_Interface, + "scope.RootDefinition": premadeThriftType_scope_RootDefinition, + "scope.Definition": premadeThriftType_scope_Definition, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("scope.Transitive"). @@ -152,6 +172,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/thrift/metadata.go b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/thrift/metadata.go index 96afd56c4fd..b87a254dd58 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -112,6 +112,29 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "thrift.RpcPriority": premadeThriftType_thrift_RpcPriority, + "thrift.Experimental": premadeThriftType_thrift_Experimental, + "i32": premadeThriftType_i32, + "thrift.ReserveIds": premadeThriftType_thrift_ReserveIds, + "bool": premadeThriftType_bool, + "thrift.RequiresBackwardCompatibility": premadeThriftType_thrift_RequiresBackwardCompatibility, + "thrift.TerseWrite": premadeThriftType_thrift_TerseWrite, + "thrift.Box": premadeThriftType_thrift_Box, + "thrift.Mixin": premadeThriftType_thrift_Mixin, + "thrift.SerializeInFieldIdOrder": premadeThriftType_thrift_SerializeInFieldIdOrder, + "thrift.BitmaskEnum": premadeThriftType_thrift_BitmaskEnum, + "thrift.ExceptionMessage": premadeThriftType_thrift_ExceptionMessage, + "thrift.InternBox": premadeThriftType_thrift_InternBox, + "thrift.Serial": premadeThriftType_thrift_Serial, + "string": premadeThriftType_string, + "thrift.Uri": premadeThriftType_thrift_Uri, + "thrift.Priority": premadeThriftType_thrift_Priority, + "thrift.DeprecatedUnvalidatedAnnotations": premadeThriftType_thrift_DeprecatedUnvalidatedAnnotations, + "thrift.AllowReservedIdentifier": premadeThriftType_thrift_AllowReservedIdentifier, + "thrift.AllowReservedFilename": premadeThriftType_thrift_AllowReservedFilename, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("thrift.Experimental"). @@ -233,6 +256,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/metadata.go index 8ce1d9b40cc..0dcf7eca75e 100644 --- a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/metadata.go @@ -31,12 +31,14 @@ var ( premadeThriftType_void = metadata.NewThriftType().SetTPrimitive( metadata.ThriftPrimitiveType_THRIFT_VOID_TYPE.Ptr(), ) - premadeThriftType_shared_DoSomethingResult = metadata.NewThriftType().SetTStruct( - metadata.NewThriftStructType(). - SetName("shared.DoSomethingResult"), - ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "module.CustomException": premadeThriftType_module_CustomException, + "void": premadeThriftType_void, +} + var structMetadatas = []*metadata.ThriftStruct{ } @@ -95,11 +97,17 @@ var serviceMetadatas = []*metadata.ThriftService{ metadata.NewThriftFunction(). SetName("do_some_similar_things"). SetIsOneway(false). - SetReturnType(premadeThriftType_shared_DoSomethingResult), + SetReturnType(shared.GetMetadataThriftType("shared.DoSomethingResult")), }, ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/metadata.go b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/metadata.go index 3ae6f1c6682..475a4d01742 100644 --- a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/metadata.go +++ b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/metadata.go @@ -31,6 +31,12 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "i32": premadeThriftType_i32, + "shared.DoSomethingResult": premadeThriftType_shared_DoSomethingResult, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("shared.DoSomethingResult"). @@ -66,6 +72,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/cpp/metadata.go b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/cpp/metadata.go index cf22fe0abc1..db548a91fa5 100644 --- a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/cpp/metadata.go +++ b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/cpp/metadata.go @@ -107,6 +107,31 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "cpp.RefType": premadeThriftType_cpp_RefType, + "cpp.EnumUnderlyingType": premadeThriftType_cpp_EnumUnderlyingType, + "string": premadeThriftType_string, + "cpp.Type": premadeThriftType_cpp_Type, + "cpp.Ref": premadeThriftType_cpp_Ref, + "cpp.Name": premadeThriftType_cpp_Name, + "bool": premadeThriftType_bool, + "cpp.Lazy": premadeThriftType_cpp_Lazy, + "cpp.DisableLazyChecksum": premadeThriftType_cpp_DisableLazyChecksum, + "cpp.Adapter": premadeThriftType_cpp_Adapter, + "cpp.PackIsset": premadeThriftType_cpp_PackIsset, + "cpp.MinimizePadding": premadeThriftType_cpp_MinimizePadding, + "cpp.ScopedEnumAsUnionType": premadeThriftType_cpp_ScopedEnumAsUnionType, + "cpp.FieldInterceptor": premadeThriftType_cpp_FieldInterceptor, + "cpp.UseOpEncode": premadeThriftType_cpp_UseOpEncode, + "cpp.EnumType": premadeThriftType_cpp_EnumType, + "cpp.Frozen2Exclude": premadeThriftType_cpp_Frozen2Exclude, + "cpp.Frozen2RequiresCompleteContainerParams": premadeThriftType_cpp_Frozen2RequiresCompleteContainerParams, + "cpp.ProcessInEbThreadUnsafe": premadeThriftType_cpp_ProcessInEbThreadUnsafe, + "cpp.RuntimeAnnotation": premadeThriftType_cpp_RuntimeAnnotation, + "cpp.UseCursorSerialization": premadeThriftType_cpp_UseCursorSerialization, + "cpp.GenerateDeprecatedHeaderClientMethods": premadeThriftType_cpp_GenerateDeprecatedHeaderClientMethods, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("cpp.Type"). @@ -295,6 +320,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/scope/metadata.go b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/scope/metadata.go index 3de904bdcd8..e88c87e625e 100644 --- a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -89,6 +89,26 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "scope.Transitive": premadeThriftType_scope_Transitive, + "scope.Program": premadeThriftType_scope_Program, + "scope.Struct": premadeThriftType_scope_Struct, + "scope.Union": premadeThriftType_scope_Union, + "scope.Exception": premadeThriftType_scope_Exception, + "scope.Field": premadeThriftType_scope_Field, + "scope.Typedef": premadeThriftType_scope_Typedef, + "scope.Service": premadeThriftType_scope_Service, + "scope.Interaction": premadeThriftType_scope_Interaction, + "scope.Function": premadeThriftType_scope_Function, + "scope.EnumValue": premadeThriftType_scope_EnumValue, + "scope.Const": premadeThriftType_scope_Const, + "scope.Enum": premadeThriftType_scope_Enum, + "scope.Structured": premadeThriftType_scope_Structured, + "scope.Interface": premadeThriftType_scope_Interface, + "scope.RootDefinition": premadeThriftType_scope_RootDefinition, + "scope.Definition": premadeThriftType_scope_Definition, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("scope.Transitive"). @@ -152,6 +172,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/thrift/metadata.go b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/thrift/metadata.go index 96afd56c4fd..b87a254dd58 100644 --- a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -112,6 +112,29 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "thrift.RpcPriority": premadeThriftType_thrift_RpcPriority, + "thrift.Experimental": premadeThriftType_thrift_Experimental, + "i32": premadeThriftType_i32, + "thrift.ReserveIds": premadeThriftType_thrift_ReserveIds, + "bool": premadeThriftType_bool, + "thrift.RequiresBackwardCompatibility": premadeThriftType_thrift_RequiresBackwardCompatibility, + "thrift.TerseWrite": premadeThriftType_thrift_TerseWrite, + "thrift.Box": premadeThriftType_thrift_Box, + "thrift.Mixin": premadeThriftType_thrift_Mixin, + "thrift.SerializeInFieldIdOrder": premadeThriftType_thrift_SerializeInFieldIdOrder, + "thrift.BitmaskEnum": premadeThriftType_thrift_BitmaskEnum, + "thrift.ExceptionMessage": premadeThriftType_thrift_ExceptionMessage, + "thrift.InternBox": premadeThriftType_thrift_InternBox, + "thrift.Serial": premadeThriftType_thrift_Serial, + "string": premadeThriftType_string, + "thrift.Uri": premadeThriftType_thrift_Uri, + "thrift.Priority": premadeThriftType_thrift_Priority, + "thrift.DeprecatedUnvalidatedAnnotations": premadeThriftType_thrift_DeprecatedUnvalidatedAnnotations, + "thrift.AllowReservedIdentifier": premadeThriftType_thrift_AllowReservedIdentifier, + "thrift.AllowReservedFilename": premadeThriftType_thrift_AllowReservedFilename, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("thrift.Experimental"). @@ -233,6 +256,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/metadata.go b/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/metadata.go index c788fde9025..27e39624b4a 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/metadata.go +++ b/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/metadata.go @@ -28,6 +28,11 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i64": premadeThriftType_i64, + "module.Foo": premadeThriftType_module_Foo, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.Foo"). @@ -71,6 +76,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/metadata.go b/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/metadata.go index 2411d45600d..8bd204861e4 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/metadata.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/metadata.go @@ -28,6 +28,11 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i64": premadeThriftType_i64, + "emptyns.Foo": premadeThriftType_emptyns_Foo, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("emptyns.Foo"). @@ -71,6 +76,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/metadata.go b/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/metadata.go index 7708b690277..dea88169bfd 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/metadata.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/metadata.go @@ -24,12 +24,12 @@ var ( premadeThriftType_bool = metadata.NewThriftType().SetTPrimitive( metadata.ThriftPrimitiveType_THRIFT_BOOL_TYPE.Ptr(), ) - premadeThriftType_hsmodule_HsFoo = metadata.NewThriftType().SetTStruct( - metadata.NewThriftStructType(). - SetName("hsmodule.HsFoo"), - ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "bool": premadeThriftType_bool, +} + var structMetadatas = []*metadata.ThriftStruct{ } @@ -55,13 +55,19 @@ var serviceMetadatas = []*metadata.ThriftService{ SetId(1). SetName("struct1"). SetIsOptional(false). - SetType(premadeThriftType_hsmodule_HsFoo), + SetType(test0.GetMetadataThriftType("hsmodule.HsFoo")), }, ), }, ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/metadata.go b/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/metadata.go index d2e5ab0c50b..a949d961301 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/metadata.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/metadata.go @@ -28,6 +28,11 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i64": premadeThriftType_i64, + "hsmodule.HsFoo": premadeThriftType_hsmodule_HsFoo, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("hsmodule.HsFoo"). @@ -71,6 +76,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/metadata.go b/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/metadata.go index fb416c5b04e..80c6d7df8f7 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/metadata.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/metadata.go @@ -28,6 +28,11 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i64": premadeThriftType_i64, + "hsmodule.HsFoo": premadeThriftType_hsmodule_HsFoo, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("hsmodule.HsFoo"). @@ -71,6 +76,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/metadata.go b/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/metadata.go index e4252dfe035..e0535d83f8c 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/metadata.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/metadata.go @@ -28,6 +28,11 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i64": premadeThriftType_i64, + "quoted.Foo": premadeThriftType_quoted_Foo, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("quoted.Foo"). @@ -71,6 +76,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/metadata.go b/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/metadata.go index 7cf1f048d67..660a4800c87 100644 --- a/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/metadata.go +++ b/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/metadata.go @@ -28,6 +28,11 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i64": premadeThriftType_i64, + "module.Foo": premadeThriftType_module_Foo, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.Foo"). @@ -71,6 +76,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/metadata.go b/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/metadata.go index 47fe75ebc62..406d32a28f9 100644 --- a/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/metadata.go +++ b/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/metadata.go @@ -28,6 +28,11 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i64": premadeThriftType_i64, + "module.Foo": premadeThriftType_module_Foo, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.Foo"). @@ -71,6 +76,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/optionals/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/optionals/out/go/gen-go/module/metadata.go index abed2e5bdb4..6315ad8d03b 100644 --- a/thrift/compiler/test/fixtures/optionals/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/optionals/out/go/gen-go/module/metadata.go @@ -70,6 +70,19 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "module.Animal": premadeThriftType_module_Animal, + "double": premadeThriftType_double, + "module.Color": premadeThriftType_module_Color, + "string": premadeThriftType_string, + "bool": premadeThriftType_bool, + "module.Vehicle": premadeThriftType_module_Vehicle, + "i64": premadeThriftType_i64, + "module.PersonID": premadeThriftType_module_PersonID, + "i16": premadeThriftType_i16, + "module.Person": premadeThriftType_module_Person, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.Color"). @@ -207,6 +220,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/params/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/params/out/go/gen-go/module/metadata.go index 512caccf06f..e07cbfac9b8 100644 --- a/thrift/compiler/test/fixtures/params/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/params/out/go/gen-go/module/metadata.go @@ -71,6 +71,11 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "void": premadeThriftType_void, + "i32": premadeThriftType_i32, +} + var structMetadatas = []*metadata.ThriftStruct{ } @@ -154,6 +159,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/module/metadata.go index 2ee098001de..028ed6e60cb 100644 --- a/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/module/metadata.go @@ -32,6 +32,12 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i32": premadeThriftType_i32, + "module.Foo": premadeThriftType_module_Foo, + "module.Foo2": premadeThriftType_module_Foo2, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.Foo"). @@ -88,6 +94,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/scope/metadata.go b/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/scope/metadata.go index 3de904bdcd8..e88c87e625e 100644 --- a/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -89,6 +89,26 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "scope.Transitive": premadeThriftType_scope_Transitive, + "scope.Program": premadeThriftType_scope_Program, + "scope.Struct": premadeThriftType_scope_Struct, + "scope.Union": premadeThriftType_scope_Union, + "scope.Exception": premadeThriftType_scope_Exception, + "scope.Field": premadeThriftType_scope_Field, + "scope.Typedef": premadeThriftType_scope_Typedef, + "scope.Service": premadeThriftType_scope_Service, + "scope.Interaction": premadeThriftType_scope_Interaction, + "scope.Function": premadeThriftType_scope_Function, + "scope.EnumValue": premadeThriftType_scope_EnumValue, + "scope.Const": premadeThriftType_scope_Const, + "scope.Enum": premadeThriftType_scope_Enum, + "scope.Structured": premadeThriftType_scope_Structured, + "scope.Interface": premadeThriftType_scope_Interface, + "scope.RootDefinition": premadeThriftType_scope_RootDefinition, + "scope.Definition": premadeThriftType_scope_Definition, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("scope.Transitive"). @@ -152,6 +172,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/thrift/metadata.go b/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/thrift/metadata.go index 96afd56c4fd..b87a254dd58 100644 --- a/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -112,6 +112,29 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "thrift.RpcPriority": premadeThriftType_thrift_RpcPriority, + "thrift.Experimental": premadeThriftType_thrift_Experimental, + "i32": premadeThriftType_i32, + "thrift.ReserveIds": premadeThriftType_thrift_ReserveIds, + "bool": premadeThriftType_bool, + "thrift.RequiresBackwardCompatibility": premadeThriftType_thrift_RequiresBackwardCompatibility, + "thrift.TerseWrite": premadeThriftType_thrift_TerseWrite, + "thrift.Box": premadeThriftType_thrift_Box, + "thrift.Mixin": premadeThriftType_thrift_Mixin, + "thrift.SerializeInFieldIdOrder": premadeThriftType_thrift_SerializeInFieldIdOrder, + "thrift.BitmaskEnum": premadeThriftType_thrift_BitmaskEnum, + "thrift.ExceptionMessage": premadeThriftType_thrift_ExceptionMessage, + "thrift.InternBox": premadeThriftType_thrift_InternBox, + "thrift.Serial": premadeThriftType_thrift_Serial, + "string": premadeThriftType_string, + "thrift.Uri": premadeThriftType_thrift_Uri, + "thrift.Priority": premadeThriftType_thrift_Priority, + "thrift.DeprecatedUnvalidatedAnnotations": premadeThriftType_thrift_DeprecatedUnvalidatedAnnotations, + "thrift.AllowReservedIdentifier": premadeThriftType_thrift_AllowReservedIdentifier, + "thrift.AllowReservedFilename": premadeThriftType_thrift_AllowReservedFilename, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("thrift.Experimental"). @@ -233,6 +256,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/terse_write/metadata.go b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/terse_write/metadata.go index 5c01e6f7b1e..3b72a13b0b4 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/terse_write/metadata.go +++ b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/terse_write/metadata.go @@ -106,6 +106,29 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "terse_write.MyEnum": premadeThriftType_terse_write_MyEnum, + "terse_write.MyStruct": premadeThriftType_terse_write_MyStruct, + "bool": premadeThriftType_bool, + "byte": premadeThriftType_byte, + "i16": premadeThriftType_i16, + "i32": premadeThriftType_i32, + "i64": premadeThriftType_i64, + "float": premadeThriftType_float, + "double": premadeThriftType_double, + "string": premadeThriftType_string, + "binary": premadeThriftType_binary, + "terse_write.MyUnion": premadeThriftType_terse_write_MyUnion, + "terse_write.MyStructWithCustomDefault": premadeThriftType_terse_write_MyStructWithCustomDefault, + "terse_write.StructLevelTerseStruct": premadeThriftType_terse_write_StructLevelTerseStruct, + "terse_write.FieldLevelTerseStruct": premadeThriftType_terse_write_FieldLevelTerseStruct, + "terse_write.TerseStructWithCustomDefault": premadeThriftType_terse_write_TerseStructWithCustomDefault, + "terse_write.MyInteger": premadeThriftType_terse_write_MyInteger, + "terse_write.AdaptedFields": premadeThriftType_terse_write_AdaptedFields, + "terse_write.WrappedFields": premadeThriftType_terse_write_WrappedFields, + "terse_write.TerseException": premadeThriftType_terse_write_TerseException, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("terse_write.MyStruct"). @@ -579,6 +602,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/cpp/metadata.go b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/cpp/metadata.go index cf22fe0abc1..db548a91fa5 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/cpp/metadata.go +++ b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/cpp/metadata.go @@ -107,6 +107,31 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "cpp.RefType": premadeThriftType_cpp_RefType, + "cpp.EnumUnderlyingType": premadeThriftType_cpp_EnumUnderlyingType, + "string": premadeThriftType_string, + "cpp.Type": premadeThriftType_cpp_Type, + "cpp.Ref": premadeThriftType_cpp_Ref, + "cpp.Name": premadeThriftType_cpp_Name, + "bool": premadeThriftType_bool, + "cpp.Lazy": premadeThriftType_cpp_Lazy, + "cpp.DisableLazyChecksum": premadeThriftType_cpp_DisableLazyChecksum, + "cpp.Adapter": premadeThriftType_cpp_Adapter, + "cpp.PackIsset": premadeThriftType_cpp_PackIsset, + "cpp.MinimizePadding": premadeThriftType_cpp_MinimizePadding, + "cpp.ScopedEnumAsUnionType": premadeThriftType_cpp_ScopedEnumAsUnionType, + "cpp.FieldInterceptor": premadeThriftType_cpp_FieldInterceptor, + "cpp.UseOpEncode": premadeThriftType_cpp_UseOpEncode, + "cpp.EnumType": premadeThriftType_cpp_EnumType, + "cpp.Frozen2Exclude": premadeThriftType_cpp_Frozen2Exclude, + "cpp.Frozen2RequiresCompleteContainerParams": premadeThriftType_cpp_Frozen2RequiresCompleteContainerParams, + "cpp.ProcessInEbThreadUnsafe": premadeThriftType_cpp_ProcessInEbThreadUnsafe, + "cpp.RuntimeAnnotation": premadeThriftType_cpp_RuntimeAnnotation, + "cpp.UseCursorSerialization": premadeThriftType_cpp_UseCursorSerialization, + "cpp.GenerateDeprecatedHeaderClientMethods": premadeThriftType_cpp_GenerateDeprecatedHeaderClientMethods, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("cpp.Type"). @@ -295,6 +320,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/hack/metadata.go b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/hack/metadata.go index f1ac0716976..bdbf8156f6a 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/hack/metadata.go +++ b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/hack/metadata.go @@ -68,6 +68,20 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "string": premadeThriftType_string, + "hack.FieldWrapper": premadeThriftType_hack_FieldWrapper, + "hack.Wrapper": premadeThriftType_hack_Wrapper, + "hack.Adapter": premadeThriftType_hack_Adapter, + "hack.SkipCodegen": premadeThriftType_hack_SkipCodegen, + "hack.Name": premadeThriftType_hack_Name, + "hack.UnionEnumAttributes": premadeThriftType_hack_UnionEnumAttributes, + "hack.StructTrait": premadeThriftType_hack_StructTrait, + "hack.Attributes": premadeThriftType_hack_Attributes, + "hack.StructAsTrait": premadeThriftType_hack_StructAsTrait, + "hack.ModuleInternal": premadeThriftType_hack_ModuleInternal, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("hack.FieldWrapper"). @@ -197,6 +211,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/scope/metadata.go b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/scope/metadata.go index 3de904bdcd8..e88c87e625e 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -89,6 +89,26 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "scope.Transitive": premadeThriftType_scope_Transitive, + "scope.Program": premadeThriftType_scope_Program, + "scope.Struct": premadeThriftType_scope_Struct, + "scope.Union": premadeThriftType_scope_Union, + "scope.Exception": premadeThriftType_scope_Exception, + "scope.Field": premadeThriftType_scope_Field, + "scope.Typedef": premadeThriftType_scope_Typedef, + "scope.Service": premadeThriftType_scope_Service, + "scope.Interaction": premadeThriftType_scope_Interaction, + "scope.Function": premadeThriftType_scope_Function, + "scope.EnumValue": premadeThriftType_scope_EnumValue, + "scope.Const": premadeThriftType_scope_Const, + "scope.Enum": premadeThriftType_scope_Enum, + "scope.Structured": premadeThriftType_scope_Structured, + "scope.Interface": premadeThriftType_scope_Interface, + "scope.RootDefinition": premadeThriftType_scope_RootDefinition, + "scope.Definition": premadeThriftType_scope_Definition, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("scope.Transitive"). @@ -152,6 +172,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/thrift/metadata.go b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/thrift/metadata.go index 96afd56c4fd..b87a254dd58 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -112,6 +112,29 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "thrift.RpcPriority": premadeThriftType_thrift_RpcPriority, + "thrift.Experimental": premadeThriftType_thrift_Experimental, + "i32": premadeThriftType_i32, + "thrift.ReserveIds": premadeThriftType_thrift_ReserveIds, + "bool": premadeThriftType_bool, + "thrift.RequiresBackwardCompatibility": premadeThriftType_thrift_RequiresBackwardCompatibility, + "thrift.TerseWrite": premadeThriftType_thrift_TerseWrite, + "thrift.Box": premadeThriftType_thrift_Box, + "thrift.Mixin": premadeThriftType_thrift_Mixin, + "thrift.SerializeInFieldIdOrder": premadeThriftType_thrift_SerializeInFieldIdOrder, + "thrift.BitmaskEnum": premadeThriftType_thrift_BitmaskEnum, + "thrift.ExceptionMessage": premadeThriftType_thrift_ExceptionMessage, + "thrift.InternBox": premadeThriftType_thrift_InternBox, + "thrift.Serial": premadeThriftType_thrift_Serial, + "string": premadeThriftType_string, + "thrift.Uri": premadeThriftType_thrift_Uri, + "thrift.Priority": premadeThriftType_thrift_Priority, + "thrift.DeprecatedUnvalidatedAnnotations": premadeThriftType_thrift_DeprecatedUnvalidatedAnnotations, + "thrift.AllowReservedIdentifier": premadeThriftType_thrift_AllowReservedIdentifier, + "thrift.AllowReservedFilename": premadeThriftType_thrift_AllowReservedFilename, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("thrift.Experimental"). @@ -233,6 +256,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/types/out/go/gen-go/included/metadata.go b/thrift/compiler/test/fixtures/types/out/go/gen-go/included/metadata.go index 1a803b805f3..229740a449d 100644 --- a/thrift/compiler/test/fixtures/types/out/go/gen-go/included/metadata.go +++ b/thrift/compiler/test/fixtures/types/out/go/gen-go/included/metadata.go @@ -46,6 +46,13 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "i32": premadeThriftType_i32, + "string": premadeThriftType_string, + "included.SomeMap": premadeThriftType_included_SomeMap, + "included.SomeListOfTypeMap": premadeThriftType_included_SomeListOfTypeMap, +} + var structMetadatas = []*metadata.ThriftStruct{ } @@ -58,6 +65,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/types/out/go/gen-go/module/metadata.go b/thrift/compiler/test/fixtures/types/out/go/gen-go/module/metadata.go index 6de30f792f7..35b23e6564f 100644 --- a/thrift/compiler/test/fixtures/types/out/go/gen-go/module/metadata.go +++ b/thrift/compiler/test/fixtures/types/out/go/gen-go/module/metadata.go @@ -70,11 +70,6 @@ var ( SetName("module.map_i32_string_1261"). SetUnderlyingType(premadeThriftType_map_i32_string), ) - premadeThriftType_included_SomeMap = metadata.NewThriftType().SetTTypedef( - metadata.NewThriftTypedefType(). - SetName("included.SomeMap"). - SetUnderlyingType(premadeThriftType_map_i32_string), - ) premadeThriftType_module_ContainerStruct = metadata.NewThriftType().SetTStruct( metadata.NewThriftStructType(). SetName("module.ContainerStruct"), @@ -159,17 +154,12 @@ var ( ) premadeThriftType_list_included_SomeMap = metadata.NewThriftType().SetTList( metadata.NewThriftListType(). - SetValueType(premadeThriftType_included_SomeMap), - ) - premadeThriftType_included_SomeListOfTypeMap = metadata.NewThriftType().SetTTypedef( - metadata.NewThriftTypedefType(). - SetName("included.SomeListOfTypeMap"). - SetUnderlyingType(premadeThriftType_list_included_SomeMap), + SetValueType(included.GetMetadataThriftType("included.SomeMap")), ) premadeThriftType_module_SomeListOfTypeMap_2468 = metadata.NewThriftType().SetTTypedef( metadata.NewThriftTypedefType(). SetName("module.SomeListOfTypeMap_2468"). - SetUnderlyingType(premadeThriftType_included_SomeListOfTypeMap), + SetUnderlyingType(included.GetMetadataThriftType("included.SomeListOfTypeMap")), ) premadeThriftType_module_AnnotatedTypes = metadata.NewThriftType().SetTStruct( metadata.NewThriftStructType(). @@ -328,6 +318,66 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "module.has_bitwise_ops": premadeThriftType_module_has_bitwise_ops, + "module.is_unscoped": premadeThriftType_module_is_unscoped, + "module.MyForwardRefEnum": premadeThriftType_module_MyForwardRefEnum, + "module.empty_struct": premadeThriftType_module_empty_struct, + "string": premadeThriftType_string, + "module.decorated_struct": premadeThriftType_module_decorated_struct, + "i32": premadeThriftType_i32, + "module.set_i32_7194": premadeThriftType_module_set_i32_7194, + "module.map_i32_string_1261": premadeThriftType_module_map_i32_string_1261, + "module.ContainerStruct": premadeThriftType_module_ContainerStruct, + "module.CppTypeStruct": premadeThriftType_module_CppTypeStruct, + "i64": premadeThriftType_i64, + "module.VirtualStruct": premadeThriftType_module_VirtualStruct, + "module.MyStructWithForwardRefEnum": premadeThriftType_module_MyStructWithForwardRefEnum, + "bool": premadeThriftType_bool, + "module.TrivialNumeric": premadeThriftType_module_TrivialNumeric, + "module.TrivialNestedWithDefault": premadeThriftType_module_TrivialNestedWithDefault, + "module.ComplexString": premadeThriftType_module_ComplexString, + "module.ComplexNestedWithDefault": premadeThriftType_module_ComplexNestedWithDefault, + "byte": premadeThriftType_byte, + "i16": premadeThriftType_i16, + "module.MinPadding": premadeThriftType_module_MinPadding, + "module.MinPaddingWithCustomType": premadeThriftType_module_MinPaddingWithCustomType, + "module.MyDataItem": premadeThriftType_module_MyDataItem, + "module.MyStruct": premadeThriftType_module_MyStruct, + "module.Renaming": premadeThriftType_module_Renaming, + "binary": premadeThriftType_binary, + "module.TBinary": premadeThriftType_module_TBinary, + "module.TBinary_8623": premadeThriftType_module_TBinary_8623, + "module.SomeListOfTypeMap_2468": premadeThriftType_module_SomeListOfTypeMap_2468, + "module.AnnotatedTypes": premadeThriftType_module_AnnotatedTypes, + "module.ForwardUsageStruct": premadeThriftType_module_ForwardUsageStruct, + "module.ForwardUsageByRef": premadeThriftType_module_ForwardUsageByRef, + "module.ForwardUsageRoot": premadeThriftType_module_ForwardUsageRoot, + "module.IncompleteMapDep": premadeThriftType_module_IncompleteMapDep, + "module.IncompleteMap": premadeThriftType_module_IncompleteMap, + "module.CompleteMapDep": premadeThriftType_module_CompleteMapDep, + "module.CompleteMap": premadeThriftType_module_CompleteMap, + "module.IncompleteListDep": premadeThriftType_module_IncompleteListDep, + "module.IncompleteList": premadeThriftType_module_IncompleteList, + "module.CompleteListDep": premadeThriftType_module_CompleteListDep, + "module.CompleteList": premadeThriftType_module_CompleteList, + "module.AdaptedListDep": premadeThriftType_module_AdaptedListDep, + "module.AdaptedList": premadeThriftType_module_AdaptedList, + "module.DependentAdaptedListDep": premadeThriftType_module_DependentAdaptedListDep, + "module.DependentAdaptedList": premadeThriftType_module_DependentAdaptedList, + "module.list_i32_9187": premadeThriftType_module_list_i32_9187, + "module.set_i32_7070": premadeThriftType_module_set_i32_7070, + "module.map_i32_i32_9565": premadeThriftType_module_map_i32_i32_9565, + "module.string_5252": premadeThriftType_module_string_5252, + "module.i32_9314": premadeThriftType_module_i32_9314, + "module.AllocatorAware": premadeThriftType_module_AllocatorAware, + "module.AllocatorAware2": premadeThriftType_module_AllocatorAware2, + "module.IntTypedef": premadeThriftType_module_IntTypedef, + "module.UintTypedef": premadeThriftType_module_UintTypedef, + "module.TypedefStruct": premadeThriftType_module_TypedefStruct, + "module.StructWithDoubleUnderscores": premadeThriftType_module_StructWithDoubleUnderscores, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("module.empty_struct"). @@ -383,7 +433,7 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(8). SetName("fieldH"). SetIsOptional(false). - SetType(premadeThriftType_included_SomeMap), + SetType(included.GetMetadataThriftType("included.SomeMap")), metadata.NewThriftField(). SetId(12). SetName("fieldA"). @@ -908,14 +958,14 @@ var serviceMetadatas = []*metadata.ThriftService{ metadata.NewThriftFunction(). SetName("bounce_map"). SetIsOneway(false). - SetReturnType(premadeThriftType_included_SomeMap). + SetReturnType(included.GetMetadataThriftType("included.SomeMap")). SetArguments( []*metadata.ThriftField{ metadata.NewThriftField(). SetId(1). SetName("m"). SetIsOptional(false). - SetType(premadeThriftType_included_SomeMap), + SetType(included.GetMetadataThriftType("included.SomeMap")), }, ), metadata.NewThriftFunction(). @@ -935,6 +985,12 @@ var serviceMetadatas = []*metadata.ThriftService{ ), } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/cpp/metadata.go b/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/cpp/metadata.go index cf22fe0abc1..db548a91fa5 100644 --- a/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/cpp/metadata.go +++ b/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/cpp/metadata.go @@ -107,6 +107,31 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "cpp.RefType": premadeThriftType_cpp_RefType, + "cpp.EnumUnderlyingType": premadeThriftType_cpp_EnumUnderlyingType, + "string": premadeThriftType_string, + "cpp.Type": premadeThriftType_cpp_Type, + "cpp.Ref": premadeThriftType_cpp_Ref, + "cpp.Name": premadeThriftType_cpp_Name, + "bool": premadeThriftType_bool, + "cpp.Lazy": premadeThriftType_cpp_Lazy, + "cpp.DisableLazyChecksum": premadeThriftType_cpp_DisableLazyChecksum, + "cpp.Adapter": premadeThriftType_cpp_Adapter, + "cpp.PackIsset": premadeThriftType_cpp_PackIsset, + "cpp.MinimizePadding": premadeThriftType_cpp_MinimizePadding, + "cpp.ScopedEnumAsUnionType": premadeThriftType_cpp_ScopedEnumAsUnionType, + "cpp.FieldInterceptor": premadeThriftType_cpp_FieldInterceptor, + "cpp.UseOpEncode": premadeThriftType_cpp_UseOpEncode, + "cpp.EnumType": premadeThriftType_cpp_EnumType, + "cpp.Frozen2Exclude": premadeThriftType_cpp_Frozen2Exclude, + "cpp.Frozen2RequiresCompleteContainerParams": premadeThriftType_cpp_Frozen2RequiresCompleteContainerParams, + "cpp.ProcessInEbThreadUnsafe": premadeThriftType_cpp_ProcessInEbThreadUnsafe, + "cpp.RuntimeAnnotation": premadeThriftType_cpp_RuntimeAnnotation, + "cpp.UseCursorSerialization": premadeThriftType_cpp_UseCursorSerialization, + "cpp.GenerateDeprecatedHeaderClientMethods": premadeThriftType_cpp_GenerateDeprecatedHeaderClientMethods, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("cpp.Type"). @@ -295,6 +320,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/scope/metadata.go b/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/scope/metadata.go index 3de904bdcd8..e88c87e625e 100644 --- a/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -89,6 +89,26 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "scope.Transitive": premadeThriftType_scope_Transitive, + "scope.Program": premadeThriftType_scope_Program, + "scope.Struct": premadeThriftType_scope_Struct, + "scope.Union": premadeThriftType_scope_Union, + "scope.Exception": premadeThriftType_scope_Exception, + "scope.Field": premadeThriftType_scope_Field, + "scope.Typedef": premadeThriftType_scope_Typedef, + "scope.Service": premadeThriftType_scope_Service, + "scope.Interaction": premadeThriftType_scope_Interaction, + "scope.Function": premadeThriftType_scope_Function, + "scope.EnumValue": premadeThriftType_scope_EnumValue, + "scope.Const": premadeThriftType_scope_Const, + "scope.Enum": premadeThriftType_scope_Enum, + "scope.Structured": premadeThriftType_scope_Structured, + "scope.Interface": premadeThriftType_scope_Interface, + "scope.RootDefinition": premadeThriftType_scope_RootDefinition, + "scope.Definition": premadeThriftType_scope_Definition, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("scope.Transitive"). @@ -152,6 +172,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata() diff --git a/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/thrift/metadata.go b/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/thrift/metadata.go index 96afd56c4fd..b87a254dd58 100644 --- a/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -112,6 +112,29 @@ var ( ) ) +var premadeThriftTypesMap = map[string]*metadata.ThriftType{ + "thrift.RpcPriority": premadeThriftType_thrift_RpcPriority, + "thrift.Experimental": premadeThriftType_thrift_Experimental, + "i32": premadeThriftType_i32, + "thrift.ReserveIds": premadeThriftType_thrift_ReserveIds, + "bool": premadeThriftType_bool, + "thrift.RequiresBackwardCompatibility": premadeThriftType_thrift_RequiresBackwardCompatibility, + "thrift.TerseWrite": premadeThriftType_thrift_TerseWrite, + "thrift.Box": premadeThriftType_thrift_Box, + "thrift.Mixin": premadeThriftType_thrift_Mixin, + "thrift.SerializeInFieldIdOrder": premadeThriftType_thrift_SerializeInFieldIdOrder, + "thrift.BitmaskEnum": premadeThriftType_thrift_BitmaskEnum, + "thrift.ExceptionMessage": premadeThriftType_thrift_ExceptionMessage, + "thrift.InternBox": premadeThriftType_thrift_InternBox, + "thrift.Serial": premadeThriftType_thrift_Serial, + "string": premadeThriftType_string, + "thrift.Uri": premadeThriftType_thrift_Uri, + "thrift.Priority": premadeThriftType_thrift_Priority, + "thrift.DeprecatedUnvalidatedAnnotations": premadeThriftType_thrift_DeprecatedUnvalidatedAnnotations, + "thrift.AllowReservedIdentifier": premadeThriftType_thrift_AllowReservedIdentifier, + "thrift.AllowReservedFilename": premadeThriftType_thrift_AllowReservedFilename, +} + var structMetadatas = []*metadata.ThriftStruct{ metadata.NewThriftStruct(). SetName("thrift.Experimental"). @@ -233,6 +256,12 @@ var enumMetadatas = []*metadata.ThriftEnum{ var serviceMetadatas = []*metadata.ThriftService{ } +// GetMetadataThriftType (INTERNAL USE ONLY). +// Returns metadata ThriftType for a given full type name. +func GetMetadataThriftType(fullName string) *metadata.ThriftType { + return premadeThriftTypesMap[fullName] +} + // GetThriftMetadata returns complete Thrift metadata for current and imported packages. func GetThriftMetadata() *metadata.ThriftMetadata { allEnums := GetEnumsMetadata()