Versions in this module Expand all Collapse all v0 v0.3.18 Sep 20, 2024 Changes in this version + const DefaultMetaLib + const DefaultThriftLib + const DefaultUnknownLib + const KitexStreamingLib + const ThriftFieldMaskLib + const ThriftJSONUtilLib + const ThriftOptionLib + const ThriftReflectionLib + func BackQuoted(s string) string + func BuildRefScope(cu *CodeUtils, ast *parser.Thrift) (*Scope, *Scope, error) + func GetImportPackage(path string) string + func GetImportPath(cu *CodeUtils, ast *parser.Thrift) string + func GetTypeID(t *parser.Type) string + func GetTypeIDConstant(t *parser.Type) string + func IsBaseType(t *parser.Type) bool + func IsConstantInGo(v *parser.Constant) bool + func IsFixedLengthType(t *parser.Type) bool + func IsIntType(t *parser.Type) bool + func IsStrType(t *parser.Type) bool + func JoinPath(elem ...string) string + func NeedRedirect(f *parser.Field) bool + func SupportIsSet(f *parser.Field) bool + func ToRefFilename(keepName bool, filename string) string + func ToReflectionFilename(filename string) string + func ToReflectionRefFilename(keepName bool, filename string) string + func ZeroWriter(t *parser.Type, oprot string, err string) string + type Code string + func (c Code) String() string + type CodeUtils struct + func NewCodeUtils(log backend.LogFunc) *CodeUtils + func (cu *CodeUtils) BuildFuncMap() template.FuncMap + func (cu *CodeUtils) CombineOutputPath(outputPath string, t *parser.Thrift) string + func (cu *CodeUtils) Debug(vs ...interface{}) string + func (cu *CodeUtils) Features() Features + func (cu *CodeUtils) GenFieldTags(f *Field, insertPoint string) (string, error) + func (cu *CodeUtils) GenTags(f *parser.Field, insertPoint string) (string, error) + func (cu *CodeUtils) GetFilePath(t *parser.Thrift) string + func (cu *CodeUtils) GetFilename(t *parser.Thrift) string + func (cu *CodeUtils) GetKeyType(s *Scope, t *parser.Type) (*Scope, *parser.Type, error) + func (cu *CodeUtils) GetPackageName(ast *parser.Thrift) string + func (cu *CodeUtils) GetPackagePrefix() (pp string) + func (cu *CodeUtils) GetValType(s *Scope, t *parser.Type) (*Scope, *parser.Type, error) + func (cu *CodeUtils) HandleOptions(args []string) error + func (cu *CodeUtils) Identify(name string) (s string, err error) + func (cu *CodeUtils) Import(t *parser.Thrift) (pkg, pth string) + func (cu *CodeUtils) MkRWCtx(root *Scope, f *Field) (*ReadWriteContext, error) + func (cu *CodeUtils) NamespaceToFullImportPath(ns string) string + func (cu *CodeUtils) NamespaceToImportPath(ns string) string + func (cu *CodeUtils) NamespaceToPackage(ns string) string + func (cu *CodeUtils) NamingStyle() styles.Naming + func (cu *CodeUtils) ParseNamespace(ast *parser.Thrift) (ref, pkg, pth string) + func (cu *CodeUtils) RootScope() *Scope + func (cu *CodeUtils) SetFeatures(fs Features) + func (cu *CodeUtils) SetNamingStyle(style styles.Naming) + func (cu *CodeUtils) SetPackagePrefix(pp string) + func (cu *CodeUtils) SetRootScope(s *Scope) + func (cu *CodeUtils) SetWithFieldMask(enable bool) bool + func (cu *CodeUtils) Template() string + func (cu *CodeUtils) UseInitialisms(enable bool) + func (cu *CodeUtils) UsePackage(path, repl string) + func (cu *CodeUtils) UseTemplate(value string) error + type Constant struct + func (c *Constant) GoName() Name + func (c *Constant) GoTypeName() TypeName + func (c *Constant) Initialization() Code + type Constants []*Constant + func (cs Constants) GoConstants() (gcs Constants) + func (cs Constants) GoVariables() (gvs Constants) + type Enum struct + func (e *Enum) GoName() Name + func (e *Enum) Value(name string) *EnumValue + func (e *Enum) Values() []*EnumValue + type EnumValue struct + func (ev *EnumValue) GoLiteral() Code + func (ev *EnumValue) GoName() Name + type Features struct + AlwaysGenerateJSONTag bool + CodeRef bool + CodeRefSlim bool + CompatibleNames bool + EnableNestedStruct bool + EnableRefInterface bool + EnumAsINT32 bool + EscapeDoubleInTag bool + ExpCodeRef bool + FieldMaskHalfway bool + FieldMaskZeroRequired bool + FrugalTag bool + GenDatabaseTag bool + GenDeepEqual bool + GenOmitEmptyTag bool + GenerateJSONTag bool + GenerateSetter bool + GenerateTypeMeta bool + GetEnumAnnotation bool + JSONStringer bool + KeepCodeRefName bool + KeepUnknownFields bool + LowerCamelCaseJSONTag bool + MarshalEnum bool + MarshalEnumToText bool + NilSafe bool + NoAliasTypeReflectionMethod bool + NoDefaultSerdes bool + NoFmt bool + NoProcessor bool + ReorderFields bool + ReserveComments bool + ScanValueForEnum bool + SkipEmpty bool + SnakeTyleJSONTag bool + ThriftStreaming bool + TrimIDL bool + TypedEnumString bool + TypedefAsTypeAlias bool + UnmarshalEnum bool + UseOption bool + ValidateSet bool + ValueTypeForSIC bool + WithFieldMask bool + WithReflection bool + type Field struct + func (f *Field) DeepEqual() Name + func (f *Field) DefaultTypeName() TypeName + func (f *Field) DefaultValue() Code + func (f *Field) Getter() Name + func (f *Field) GoName() Name + func (f *Field) GoTypeName() TypeName + func (f *Field) IsNested() bool + func (f *Field) IsResponseFieldOfResult() bool + func (f *Field) IsSetter() Name + func (f *Field) Reader() Name + func (f *Field) Setter() Name + func (f *Field) Writer() Name + type FrugalResolver struct + func NewFrugalResolver(root *Scope, cu *CodeUtils) *FrugalResolver + func (r *FrugalResolver) ResolveFrugalTypeName(t *parser.Type) (TypeName, error) + type Function struct + func (f *Function) ArgType() *StructLike + func (f *Function) Arguments() []*Field + func (f *Function) GoName() Name + func (f *Function) ResType() *StructLike + func (f *Function) ResponseGoTypeName() TypeName + func (f *Function) Service() *Service + func (f *Function) Streaming() *streaming.Streaming + func (f *Function) Throws() []*Field + type GoBackend struct + func (g *GoBackend) BuiltinPlugins() []*plugin.Desc + func (g *GoBackend) Generate(req *plugin.Request, log backend.LogFunc) *plugin.Response + func (g *GoBackend) GetPlugin(desc *plugin.Desc) plugin.Plugin + func (g *GoBackend) Lang() string + func (g *GoBackend) Name() string + func (g *GoBackend) Options() (opts []plugin.Option) + func (g *GoBackend) PostProcess(path string, content []byte) ([]byte, error) + type Include struct + ImportPath string + PackageName string + type Includes []*Include + func (is Includes) ByAST(ast *parser.Thrift) *Include + func (is Includes) ByIndex(i int) *Include + func (is Includes) ByPackage(pkg string) *Include + type Name string + func (n Name) String() string + type ReadWriteContext struct + FieldMask string + IsPointer bool + KeyCtx *ReadWriteContext + NeedDecl bool + Source string + Target string + Type *parser.Type + TypeID string + TypeName TypeName + ValCtx *ReadWriteContext + func (c *ReadWriteContext) GenID(prefix string) (name string) + func (c *ReadWriteContext) NeedFieldMask() bool + func (c *ReadWriteContext) WithDecl() *ReadWriteContext + func (c *ReadWriteContext) WithFieldMask(fm string) *ReadWriteContext + func (c *ReadWriteContext) WithSource(s string) *ReadWriteContext + func (c *ReadWriteContext) WithTarget(t string) *ReadWriteContext + type Resolver struct + func NewResolver(root *Scope, cu *CodeUtils) *Resolver + func (r *Resolver) GetConstInit(name string, t *parser.Type, v *parser.ConstValue) (Code, error) + func (r *Resolver) GetDefaultValueTypeName(f *parser.Field) (TypeName, error) + func (r *Resolver) GetFieldInit(f *parser.Field) (Code, error) + func (r *Resolver) GetTypeName(g *Scope, t *parser.Type) (name TypeName, err error) + func (r *Resolver) ResolveConst(g *Scope, name string, t *parser.Type, v *parser.ConstValue) (Code, error) + func (r *Resolver) ResolveFieldTypeName(f *parser.Field) (TypeName, error) + func (r *Resolver) ResolveTypeName(t *parser.Type) (TypeName, error) + type Scope struct + func BuildScope(cu *CodeUtils, ast *parser.Thrift) (*Scope, error) + func (s *Scope) AST() *parser.Thrift + func (s *Scope) Constant(name string) *Constant + func (s *Scope) Constants() Constants + func (s *Scope) Enum(name string) *Enum + func (s *Scope) Enums() []*Enum + func (s *Scope) Exception(name string) *StructLike + func (s *Scope) Exceptions() []*StructLike + func (s *Scope) FilePackage() string + func (s *Scope) GetFirstDescriptor() string + func (s *Scope) GetOption(filepath string) []string + func (s *Scope) IDLName() string + func (s *Scope) Includes() Includes + func (s *Scope) IsEmpty() bool + func (s *Scope) MarshalDescriptor() string + func (s *Scope) Namespace() namespace.Namespace + func (s *Scope) RefPackage() string + func (s *Scope) RefPath() string + func (s *Scope) ResolveImports() (map[string]string, error) + func (s *Scope) Service(name string) *Service + func (s *Scope) Services() []*Service + func (s *Scope) Struct(name string) *StructLike + func (s *Scope) StructLike(name string) *StructLike + func (s *Scope) StructLikes() (ss []*StructLike) + func (s *Scope) Structs() []*StructLike + func (s *Scope) Typedef(alias string) *Typedef + func (s *Scope) Typedefs() []*Typedef + func (s *Scope) Union(name string) *StructLike + func (s *Scope) Unions() []*StructLike + type Service struct + func (s *Service) Base() *Service + func (s *Service) From() *Scope + func (s *Service) Function(name string) *Function + func (s *Service) Functions() []*Function + func (s *Service) GoName() Name + func (s *Service) Namespace() namespace.Namespace + type StructLike struct + func (s *StructLike) Field(name string) *Field + func (s *StructLike) Fields() []*Field + func (s *StructLike) GoName() Name + func (s *StructLike) IsAlias() bool + func (s *StructLike) Namespace() namespace.Namespace + type TypeName string + func (tn TypeName) Deref() TypeName + func (tn TypeName) IsForeign() bool + func (tn TypeName) IsPointer() bool + func (tn TypeName) NewFunc() Name + func (tn TypeName) Pointerize() TypeName + func (tn TypeName) String() string + type Typedef struct + func (t *Typedef) GoName() Name + func (t *Typedef) GoTypeName() TypeName