Documentation
¶
Overview ¶
Package parser parses a thrift IDL file with its dependencies into an abstract syntax tree. The acceptable IDL grammar is defined in the 'thrift.peg' file.
Index ¶
- Constants
- Variables
- func CircleDetect(ast *Thrift) string
- func Typename2TypeID(name string) uint8
- type ConstType
- type ConstTypedValue
- func (p *ConstTypedValue) CountSetFieldsConstTypedValue() int
- func (p *ConstTypedValue) GetDouble() float64
- func (p *ConstTypedValue) GetIdentifier() string
- func (p *ConstTypedValue) GetInt() int64
- func (p *ConstTypedValue) GetList() []*ConstValue
- func (p *ConstTypedValue) GetLiteral() string
- func (p *ConstTypedValue) GetMap() []*MapConstValue
- func (p *ConstTypedValue) IsSetDouble() bool
- func (p *ConstTypedValue) IsSetIdentifier() bool
- func (p *ConstTypedValue) IsSetInt() bool
- func (p *ConstTypedValue) IsSetList() bool
- func (p *ConstTypedValue) IsSetLiteral() bool
- func (p *ConstTypedValue) IsSetMap() bool
- func (p *ConstTypedValue) Read(iprot thrift.TProtocol) error
- func (p *ConstTypedValue) ReadField1(iprot thrift.TProtocol) error
- func (p *ConstTypedValue) ReadField2(iprot thrift.TProtocol) error
- func (p *ConstTypedValue) ReadField3(iprot thrift.TProtocol) error
- func (p *ConstTypedValue) ReadField4(iprot thrift.TProtocol) error
- func (p *ConstTypedValue) ReadField5(iprot thrift.TProtocol) error
- func (p *ConstTypedValue) ReadField6(iprot thrift.TProtocol) error
- func (p *ConstTypedValue) String() string
- func (p *ConstTypedValue) Write(oprot thrift.TProtocol) error
- type ConstValue
- func (p *ConstValue) GetType() ConstType
- func (p *ConstValue) GetTypedValue() *ConstTypedValue
- func (p *ConstValue) IsSetTypedValue() bool
- func (p *ConstValue) Read(iprot thrift.TProtocol) error
- func (p *ConstValue) ReadField1(iprot thrift.TProtocol) error
- func (p *ConstValue) ReadField2(iprot thrift.TProtocol) error
- func (t *ConstValue) String() string
- func (p *ConstValue) Write(oprot thrift.TProtocol) error
- type Constant
- func (p *Constant) GetAnnotations() map[string]string
- func (p *Constant) GetName() string
- func (p *Constant) GetType() *Type
- func (p *Constant) GetValue() *ConstValue
- func (p *Constant) IsSetType() bool
- func (p *Constant) IsSetValue() bool
- func (p *Constant) Read(iprot thrift.TProtocol) error
- func (p *Constant) ReadField1(iprot thrift.TProtocol) error
- func (p *Constant) ReadField2(iprot thrift.TProtocol) error
- func (p *Constant) ReadField3(iprot thrift.TProtocol) error
- func (p *Constant) ReadField4(iprot thrift.TProtocol) error
- func (p *Constant) String() string
- func (p *Constant) Write(oprot thrift.TProtocol) error
- type Enum
- func (p *Enum) GetAnnotations() map[string]string
- func (p *Enum) GetName() string
- func (p *Enum) GetValues() []*EnumValue
- func (p *Enum) Read(iprot thrift.TProtocol) error
- func (p *Enum) ReadField1(iprot thrift.TProtocol) error
- func (p *Enum) ReadField2(iprot thrift.TProtocol) error
- func (p *Enum) ReadField3(iprot thrift.TProtocol) error
- func (p *Enum) String() string
- func (p *Enum) Write(oprot thrift.TProtocol) error
- type EnumValue
- func (p *EnumValue) GetAnnotations() map[string]string
- func (p *EnumValue) GetName() string
- func (p *EnumValue) GetValue() int64
- func (p *EnumValue) Read(iprot thrift.TProtocol) error
- func (p *EnumValue) ReadField1(iprot thrift.TProtocol) error
- func (p *EnumValue) ReadField2(iprot thrift.TProtocol) error
- func (p *EnumValue) ReadField3(iprot thrift.TProtocol) error
- func (p *EnumValue) String() string
- func (p *EnumValue) Write(oprot thrift.TProtocol) error
- type Field
- func (p *Field) GetAnnotations() map[string]string
- func (p *Field) GetDefault() *ConstValue
- func (p *Field) GetID() int32
- func (p *Field) GetName() string
- func (p *Field) GetRequiredness() FieldType
- func (p *Field) GetType() *Type
- func (p *Field) IsSetDefault() bool
- func (p *Field) IsSetType() bool
- func (p *Field) Read(iprot thrift.TProtocol) error
- func (p *Field) ReadField1(iprot thrift.TProtocol) error
- func (p *Field) ReadField2(iprot thrift.TProtocol) error
- func (p *Field) ReadField3(iprot thrift.TProtocol) error
- func (p *Field) ReadField4(iprot thrift.TProtocol) error
- func (p *Field) ReadField5(iprot thrift.TProtocol) error
- func (p *Field) ReadField6(iprot thrift.TProtocol) error
- func (p *Field) String() string
- func (p *Field) Write(oprot thrift.TProtocol) error
- type FieldType
- type Function
- func (p *Function) GetAnnotations() map[string]string
- func (p *Function) GetArguments() []*Field
- func (p *Function) GetFunctionType() *Type
- func (p *Function) GetName() string
- func (p *Function) GetOneway() bool
- func (p *Function) GetThrows() []*Field
- func (p *Function) GetVoid() bool
- func (p *Function) IsSetFunctionType() bool
- func (p *Function) Read(iprot thrift.TProtocol) error
- func (p *Function) ReadField1(iprot thrift.TProtocol) error
- func (p *Function) ReadField2(iprot thrift.TProtocol) error
- func (p *Function) ReadField3(iprot thrift.TProtocol) error
- func (p *Function) ReadField4(iprot thrift.TProtocol) error
- func (p *Function) ReadField5(iprot thrift.TProtocol) error
- func (p *Function) ReadField6(iprot thrift.TProtocol) error
- func (p *Function) ReadField7(iprot thrift.TProtocol) error
- func (p *Function) String() string
- func (p *Function) Write(oprot thrift.TProtocol) error
- type Include
- func (p *Include) GetPath() string
- func (p *Include) GetReference() *Thrift
- func (p *Include) IsSetReference() bool
- func (p *Include) Read(iprot thrift.TProtocol) error
- func (p *Include) ReadField1(iprot thrift.TProtocol) error
- func (p *Include) ReadField2(iprot thrift.TProtocol) error
- func (p *Include) String() string
- func (p *Include) Write(oprot thrift.TProtocol) error
- type MapConstValue
- func (p *MapConstValue) GetKey() *ConstValue
- func (p *MapConstValue) GetValue() *ConstValue
- func (p *MapConstValue) IsSetKey() bool
- func (p *MapConstValue) IsSetValue() bool
- func (p *MapConstValue) Read(iprot thrift.TProtocol) error
- func (p *MapConstValue) ReadField1(iprot thrift.TProtocol) error
- func (p *MapConstValue) ReadField2(iprot thrift.TProtocol) error
- func (p *MapConstValue) String() string
- func (p *MapConstValue) Write(oprot thrift.TProtocol) error
- type Namespace
- func (p *Namespace) GetAnnotations() map[string]string
- func (p *Namespace) GetLanguage() string
- func (p *Namespace) GetName() string
- func (p *Namespace) Read(iprot thrift.TProtocol) error
- func (p *Namespace) ReadField1(iprot thrift.TProtocol) error
- func (p *Namespace) ReadField2(iprot thrift.TProtocol) error
- func (p *Namespace) ReadField3(iprot thrift.TProtocol) error
- func (p *Namespace) String() string
- func (p *Namespace) Write(oprot thrift.TProtocol) error
- type Service
- func (p *Service) GetAnnotations() map[string]string
- func (p *Service) GetExtends() string
- func (p *Service) GetFunctions() []*Function
- func (p *Service) GetName() string
- func (p *Service) Read(iprot thrift.TProtocol) error
- func (p *Service) ReadField1(iprot thrift.TProtocol) error
- func (p *Service) ReadField2(iprot thrift.TProtocol) error
- func (p *Service) ReadField3(iprot thrift.TProtocol) error
- func (p *Service) ReadField4(iprot thrift.TProtocol) error
- func (p *Service) String() string
- func (p *Service) Write(oprot thrift.TProtocol) error
- type StructLike
- func (p *StructLike) GetAnnotations() map[string]string
- func (p *StructLike) GetCategory() string
- func (st *StructLike) GetField(name string) (*Field, bool)
- func (p *StructLike) GetFields() []*Field
- func (p *StructLike) GetName() string
- func (p *StructLike) Read(iprot thrift.TProtocol) error
- func (p *StructLike) ReadField1(iprot thrift.TProtocol) error
- func (p *StructLike) ReadField2(iprot thrift.TProtocol) error
- func (p *StructLike) ReadField3(iprot thrift.TProtocol) error
- func (p *StructLike) ReadField4(iprot thrift.TProtocol) error
- func (p *StructLike) String() string
- func (p *StructLike) Write(oprot thrift.TProtocol) error
- type Thrift
- func (t *Thrift) DepthFirstSearch() chan *Thrift
- func (t *Thrift) GetConstant(name string) (*Constant, bool)
- func (p *Thrift) GetConstants() []*Constant
- func (p *Thrift) GetCppIncludes() []string
- func (t *Thrift) GetEnum(name string) (*Enum, bool)
- func (p *Thrift) GetEnums() []*Enum
- func (t *Thrift) GetException(name string) (*StructLike, bool)
- func (p *Thrift) GetExceptions() []*StructLike
- func (p *Thrift) GetFilename() string
- func (p *Thrift) GetIncludes() []*Include
- func (t *Thrift) GetNamespace(lang string) (ns string, found bool)
- func (t *Thrift) GetNamespaceOrReferenceName(lang string) string
- func (p *Thrift) GetNamespaces() []*Namespace
- func (t *Thrift) GetReference(refname string) (*Thrift, bool)
- func (t *Thrift) GetService(name string) (*Service, bool)
- func (p *Thrift) GetServices() []*Service
- func (t *Thrift) GetStruct(name string) (*StructLike, bool)
- func (t *Thrift) GetStructLike() (ss []*StructLike)
- func (p *Thrift) GetStructs() []*StructLike
- func (t *Thrift) GetTypedef(alias string) (*Typedef, bool)
- func (p *Thrift) GetTypedefs() []*Typedef
- func (t *Thrift) GetUnion(name string) (*StructLike, bool)
- func (p *Thrift) GetUnions() []*StructLike
- func (p *Thrift) Read(iprot thrift.TProtocol) error
- func (p *Thrift) ReadField1(iprot thrift.TProtocol) error
- func (p *Thrift) ReadField10(iprot thrift.TProtocol) error
- func (p *Thrift) ReadField11(iprot thrift.TProtocol) error
- func (p *Thrift) ReadField2(iprot thrift.TProtocol) error
- func (p *Thrift) ReadField3(iprot thrift.TProtocol) error
- func (p *Thrift) ReadField4(iprot thrift.TProtocol) error
- func (p *Thrift) ReadField5(iprot thrift.TProtocol) error
- func (p *Thrift) ReadField6(iprot thrift.TProtocol) error
- func (p *Thrift) ReadField7(iprot thrift.TProtocol) error
- func (p *Thrift) ReadField8(iprot thrift.TProtocol) error
- func (p *Thrift) ReadField9(iprot thrift.TProtocol) error
- func (p *Thrift) String() string
- func (p *Thrift) Write(oprot thrift.TProtocol) error
- type ThriftIDL
- func (t *ThriftIDL) AST() *node32
- func (t *ThriftIDL) Add(rule pegRule, begin, end, depth uint32, index int)
- func (t *ThriftIDL) Error() []token32
- func (t *ThriftIDL) Expand(index int)
- func (p *ThriftIDL) Highlighter()
- func (p *ThriftIDL) Init()
- func (t *ThriftIDL) Order() [][]token32
- func (t *ThriftIDL) PreOrder() (<-chan state32, [][]token32)
- func (t *ThriftIDL) Print()
- func (t *ThriftIDL) PrintSyntax()
- func (p *ThriftIDL) PrintSyntaxTree()
- func (t *ThriftIDL) Tokens() <-chan token32
- type Type
- func (p *Type) GetAnnotations() map[string]string
- func (p *Type) GetCppType() string
- func (p *Type) GetKeyType() *Type
- func (p *Type) GetName() string
- func (p *Type) GetValueType() *Type
- func (p *Type) IsSetKeyType() bool
- func (p *Type) IsSetValueType() bool
- func (p *Type) Read(iprot thrift.TProtocol) error
- func (p *Type) ReadField1(iprot thrift.TProtocol) error
- func (p *Type) ReadField2(iprot thrift.TProtocol) error
- func (p *Type) ReadField3(iprot thrift.TProtocol) error
- func (p *Type) ReadField4(iprot thrift.TProtocol) error
- func (p *Type) ReadField5(iprot thrift.TProtocol) error
- func (t *Type) String() string
- func (p *Type) Write(oprot thrift.TProtocol) error
- type Typedef
- func (p *Typedef) GetAlias() string
- func (p *Typedef) GetAnnotations() map[string]string
- func (p *Typedef) GetType() *Type
- func (p *Typedef) IsSetType() bool
- func (p *Typedef) Read(iprot thrift.TProtocol) error
- func (p *Typedef) ReadField1(iprot thrift.TProtocol) error
- func (p *Typedef) ReadField2(iprot thrift.TProtocol) error
- func (p *Typedef) ReadField3(iprot thrift.TProtocol) error
- func (p *Typedef) String() string
- func (p *Typedef) Write(oprot thrift.TProtocol) error
Constants ¶
const ( STOP = 0 VOID = 1 BOOL = 2 BYTE = 3 I08 = 3 DOUBLE = 4 I16 = 6 I32 = 8 I64 = 10 STRING = 11 UTF7 = 11 STRUCT = 12 MAP = 13 SET = 14 LIST = 15 UTF8 = 16 UTF16 = 17 BINARY = 18 UNKNOWN = 255 )
TType constants in the Thrift protocol
const NOTSET = -999999
NOTSET is a value to express 'not set'.
Variables ¶
var ConstTypedValue_Double_DEFAULT float64
var ConstTypedValue_Identifier_DEFAULT string
var ConstTypedValue_Int_DEFAULT int64
var ConstTypedValue_List_DEFAULT []*ConstValue
var ConstTypedValue_Literal_DEFAULT string
var ConstTypedValue_Map_DEFAULT []*MapConstValue
Functions ¶
func CircleDetect ¶
CircleDetect detects whether there is an include circle and return a string representing the loop. When no include circle is found, it returns an empty string.
func Typename2TypeID ¶
Typename2TypeID converts a TypeID name to its value.
Types ¶
type ConstTypedValue ¶
type ConstTypedValue struct { Double *float64 `thrift:"Double,1" json:"Double,omitempty"` Int *int64 `thrift:"Int,2" json:"Int,omitempty"` Literal *string `thrift:"Literal,3" json:"Literal,omitempty"` Identifier *string `thrift:"Identifier,4" json:"Identifier,omitempty"` List []*ConstValue `thrift:"List,5" json:"List,omitempty"` Map []*MapConstValue `thrift:"Map,6" json:"Map,omitempty"` }
var ConstValue_TypedValue_DEFAULT *ConstTypedValue
func NewConstTypedValue ¶
func NewConstTypedValue() *ConstTypedValue
func (*ConstTypedValue) CountSetFieldsConstTypedValue ¶
func (p *ConstTypedValue) CountSetFieldsConstTypedValue() int
func (*ConstTypedValue) GetDouble ¶
func (p *ConstTypedValue) GetDouble() float64
func (*ConstTypedValue) GetIdentifier ¶
func (p *ConstTypedValue) GetIdentifier() string
func (*ConstTypedValue) GetInt ¶
func (p *ConstTypedValue) GetInt() int64
func (*ConstTypedValue) GetList ¶
func (p *ConstTypedValue) GetList() []*ConstValue
func (*ConstTypedValue) GetLiteral ¶
func (p *ConstTypedValue) GetLiteral() string
func (*ConstTypedValue) GetMap ¶
func (p *ConstTypedValue) GetMap() []*MapConstValue
func (*ConstTypedValue) IsSetDouble ¶
func (p *ConstTypedValue) IsSetDouble() bool
func (*ConstTypedValue) IsSetIdentifier ¶
func (p *ConstTypedValue) IsSetIdentifier() bool
func (*ConstTypedValue) IsSetInt ¶
func (p *ConstTypedValue) IsSetInt() bool
func (*ConstTypedValue) IsSetList ¶
func (p *ConstTypedValue) IsSetList() bool
func (*ConstTypedValue) IsSetLiteral ¶
func (p *ConstTypedValue) IsSetLiteral() bool
func (*ConstTypedValue) IsSetMap ¶
func (p *ConstTypedValue) IsSetMap() bool
func (*ConstTypedValue) ReadField1 ¶
func (p *ConstTypedValue) ReadField1(iprot thrift.TProtocol) error
func (*ConstTypedValue) ReadField2 ¶
func (p *ConstTypedValue) ReadField2(iprot thrift.TProtocol) error
func (*ConstTypedValue) ReadField3 ¶
func (p *ConstTypedValue) ReadField3(iprot thrift.TProtocol) error
func (*ConstTypedValue) ReadField4 ¶
func (p *ConstTypedValue) ReadField4(iprot thrift.TProtocol) error
func (*ConstTypedValue) ReadField5 ¶
func (p *ConstTypedValue) ReadField5(iprot thrift.TProtocol) error
func (*ConstTypedValue) ReadField6 ¶
func (p *ConstTypedValue) ReadField6(iprot thrift.TProtocol) error
func (*ConstTypedValue) String ¶
func (p *ConstTypedValue) String() string
type ConstValue ¶
type ConstValue struct { Type ConstType `thrift:"Type,1" json:"Type"` TypedValue *ConstTypedValue `thrift:"TypedValue,2" json:"TypedValue,omitempty"` }
var Constant_Value_DEFAULT *ConstValue
var Field_Default_DEFAULT *ConstValue
var MapConstValue_Key_DEFAULT *ConstValue
var MapConstValue_Value_DEFAULT *ConstValue
func NewConstValue ¶
func NewConstValue() *ConstValue
func (*ConstValue) GetType ¶
func (p *ConstValue) GetType() ConstType
func (*ConstValue) GetTypedValue ¶
func (p *ConstValue) GetTypedValue() *ConstTypedValue
func (*ConstValue) IsSetTypedValue ¶
func (p *ConstValue) IsSetTypedValue() bool
func (*ConstValue) ReadField1 ¶
func (p *ConstValue) ReadField1(iprot thrift.TProtocol) error
func (*ConstValue) ReadField2 ¶
func (p *ConstValue) ReadField2(iprot thrift.TProtocol) error
func (*ConstValue) String ¶
func (t *ConstValue) String() string
type Constant ¶
type Constant struct { Name string `thrift:"Name,1" json:"Name"` Type *Type `thrift:"Type,2" json:"Type,omitempty"` Value *ConstValue `thrift:"Value,3" json:"Value,omitempty"` Annotations map[string]string `thrift:"Annotations,4" json:"Annotations"` }
func NewConstant ¶
func NewConstant() *Constant
func (*Constant) GetAnnotations ¶
func (*Constant) GetValue ¶
func (p *Constant) GetValue() *ConstValue
func (*Constant) IsSetValue ¶
type Enum ¶
type Enum struct { Name string `thrift:"Name,1" json:"Name"` Values []*EnumValue `thrift:"Values,2" json:"Values"` Annotations map[string]string `thrift:"Annotations,3" json:"Annotations"` }
func (*Enum) GetAnnotations ¶
type EnumValue ¶
type EnumValue struct { Name string `thrift:"Name,1" json:"Name"` Value int64 `thrift:"Value,2" json:"Value"` Annotations map[string]string `thrift:"Annotations,3" json:"Annotations"` }
func NewEnumValue ¶
func NewEnumValue() *EnumValue
func (*EnumValue) GetAnnotations ¶
type Field ¶
type Field struct { ID int32 `thrift:"ID,1" json:"ID"` Name string `thrift:"Name,2" json:"Name"` Requiredness FieldType `thrift:"Requiredness,3" json:"Requiredness"` Type *Type `thrift:"Type,4" json:"Type"` Default *ConstValue `thrift:"Default,5" json:"Default,omitempty"` Annotations map[string]string `thrift:"Annotations,6" json:"Annotations"` }
func (*Field) GetAnnotations ¶
func (*Field) GetDefault ¶
func (p *Field) GetDefault() *ConstValue
func (*Field) GetRequiredness ¶
func (*Field) IsSetDefault ¶
type Function ¶
type Function struct { Name string `thrift:"Name,1" json:"Name"` Oneway bool `thrift:"Oneway,2" json:"Oneway"` Void bool `thrift:"Void,3" json:"Void"` FunctionType *Type `thrift:"FunctionType,4" json:"FunctionType,omitempty"` Arguments []*Field `thrift:"Arguments,5" json:"Arguments"` Throws []*Field `thrift:"Throws,6" json:"Throws"` Annotations map[string]string `thrift:"Annotations,7" json:"Annotations"` }
func NewFunction ¶
func NewFunction() *Function
func (*Function) GetAnnotations ¶
func (*Function) GetArguments ¶
func (*Function) GetFunctionType ¶
func (*Function) IsSetFunctionType ¶
type Include ¶
type Include struct { Path string `thrift:"Path,1" json:"Path"` Reference *Thrift `thrift:"Reference,2" json:"Reference,omitempty"` }
func NewInclude ¶
func NewInclude() *Include
func (*Include) GetReference ¶
func (*Include) IsSetReference ¶
type MapConstValue ¶
type MapConstValue struct { Key *ConstValue `thrift:"Key,1" json:"Key,omitempty"` Value *ConstValue `thrift:"Value,2" json:"Value,omitempty"` }
func NewMapConstValue ¶
func NewMapConstValue() *MapConstValue
func (*MapConstValue) GetKey ¶
func (p *MapConstValue) GetKey() *ConstValue
func (*MapConstValue) GetValue ¶
func (p *MapConstValue) GetValue() *ConstValue
func (*MapConstValue) IsSetKey ¶
func (p *MapConstValue) IsSetKey() bool
func (*MapConstValue) IsSetValue ¶
func (p *MapConstValue) IsSetValue() bool
func (*MapConstValue) ReadField1 ¶
func (p *MapConstValue) ReadField1(iprot thrift.TProtocol) error
func (*MapConstValue) ReadField2 ¶
func (p *MapConstValue) ReadField2(iprot thrift.TProtocol) error
func (*MapConstValue) String ¶
func (p *MapConstValue) String() string
type Namespace ¶
type Namespace struct { Language string `thrift:"Language,1" json:"Language"` Name string `thrift:"Name,2" json:"Name"` Annotations map[string]string `thrift:"Annotations,3" json:"Annotations"` }
func NewNamespace ¶
func NewNamespace() *Namespace
func (*Namespace) GetAnnotations ¶
func (*Namespace) GetLanguage ¶
type Service ¶
type Service struct { Name string `thrift:"Name,1" json:"Name"` Extends string `thrift:"Extends,2" json:"Extends"` Functions []*Function `thrift:"Functions,3" json:"Functions"` Annotations map[string]string `thrift:"Annotations,4" json:"Annotations"` }
func NewService ¶
func NewService() *Service
func (*Service) GetAnnotations ¶
func (*Service) GetExtends ¶
func (*Service) GetFunctions ¶
type StructLike ¶
type StructLike struct { Category string `thrift:"Category,1" json:"Category"` Name string `thrift:"Name,2" json:"Name"` Fields []*Field `thrift:"Fields,3" json:"Fields"` Annotations map[string]string `thrift:"Annotations,4" json:"Annotations"` }
func NewStructLike ¶
func NewStructLike() *StructLike
func (*StructLike) GetAnnotations ¶
func (p *StructLike) GetAnnotations() map[string]string
func (*StructLike) GetCategory ¶
func (p *StructLike) GetCategory() string
func (*StructLike) GetField ¶
func (st *StructLike) GetField(name string) (*Field, bool)
GetField returns a field of the struct-like that matches the name.
func (*StructLike) GetFields ¶
func (p *StructLike) GetFields() []*Field
func (*StructLike) GetName ¶
func (p *StructLike) GetName() string
func (*StructLike) ReadField1 ¶
func (p *StructLike) ReadField1(iprot thrift.TProtocol) error
func (*StructLike) ReadField2 ¶
func (p *StructLike) ReadField2(iprot thrift.TProtocol) error
func (*StructLike) ReadField3 ¶
func (p *StructLike) ReadField3(iprot thrift.TProtocol) error
func (*StructLike) ReadField4 ¶
func (p *StructLike) ReadField4(iprot thrift.TProtocol) error
func (*StructLike) String ¶
func (p *StructLike) String() string
type Thrift ¶
type Thrift struct { Filename string `thrift:"Filename,1" json:"Filename"` Includes []*Include `thrift:"Includes,2" json:"Includes"` CppIncludes []string `thrift:"CppIncludes,3" json:"CppIncludes"` Namespaces []*Namespace `thrift:"Namespaces,4" json:"Namespaces"` Typedefs []*Typedef `thrift:"Typedefs,5" json:"Typedefs"` Constants []*Constant `thrift:"Constants,6" json:"Constants"` Enums []*Enum `thrift:"Enums,7" json:"Enums"` Structs []*StructLike `thrift:"Structs,8" json:"Structs"` Unions []*StructLike `thrift:"Unions,9" json:"Unions"` Exceptions []*StructLike `thrift:"Exceptions,10" json:"Exceptions"` Services []*Service `thrift:"Services,11" json:"Services"` }
var Include_Reference_DEFAULT *Thrift
func ParseFile ¶
ParseFile parses a thrift file and returns an AST. If recursive is true, then the include IDLs are parsed recursively as well.
func ParseString ¶
ParseString parses the thrift file path and file content then return an AST.
func (*Thrift) DepthFirstSearch ¶
DepthFirstSearch returns a channal providing Thrift ASTs in a depth-first order without duplication. Unparsed references will be ignored.
func (*Thrift) GetConstant ¶
GetConstant returns a Constant node that mathces the name.
func (*Thrift) GetConstants ¶
func (*Thrift) GetCppIncludes ¶
func (*Thrift) GetException ¶
func (t *Thrift) GetException(name string) (*StructLike, bool)
GetException returns an Exception that matches the name.
func (*Thrift) GetExceptions ¶
func (p *Thrift) GetExceptions() []*StructLike
func (*Thrift) GetFilename ¶
func (*Thrift) GetIncludes ¶
func (*Thrift) GetNamespace ¶
GetNamespace returns a namespace for the language. When both "*" and the language have a namespace defined, the latter is prefered.
func (*Thrift) GetNamespaceOrReferenceName ¶
GetNamespaceOrReferenceName returns a namespace for the language. If the namespace is not defined, then the base name without extension of the IDL will be returned.
func (*Thrift) GetNamespaces ¶
func (*Thrift) GetReference ¶
GetReference return a AST that matches the given name. References should be initialized before calling this method.
func (*Thrift) GetService ¶
GetService returns a Service node that matches the name.
func (*Thrift) GetServices ¶
func (*Thrift) GetStruct ¶
func (t *Thrift) GetStruct(name string) (*StructLike, bool)
GetStruct returns a Struct node that matches the name.
func (*Thrift) GetStructLike ¶
func (t *Thrift) GetStructLike() (ss []*StructLike)
GetStructLike returns all struct-like definitions in the AST.
func (*Thrift) GetStructs ¶
func (p *Thrift) GetStructs() []*StructLike
func (*Thrift) GetTypedef ¶
GetTypedef returns a Typedef node that matches the alias name.
func (*Thrift) GetTypedefs ¶
func (*Thrift) GetUnion ¶
func (t *Thrift) GetUnion(name string) (*StructLike, bool)
GetUnion returns a Union node that matches the name.
func (*Thrift) GetUnions ¶
func (p *Thrift) GetUnions() []*StructLike
type ThriftIDL ¶
type ThriftIDL struct { Buffer string Parse func(rule ...int) error Reset func() Pretty bool // contains filtered or unexported fields }
func (*ThriftIDL) Highlighter ¶
func (p *ThriftIDL) Highlighter()
func (*ThriftIDL) PrintSyntax ¶
func (t *ThriftIDL) PrintSyntax()
func (*ThriftIDL) PrintSyntaxTree ¶
func (p *ThriftIDL) PrintSyntaxTree()
type Type ¶
type Type struct { Name string `thrift:"Name,1" json:"Name"` KeyType *Type `thrift:"KeyType,2" json:"KeyType,omitempty"` ValueType *Type `thrift:"ValueType,3" json:"ValueType,omitempty"` CppType string `thrift:"CppType,4" json:"CppType"` Annotations map[string]string `thrift:"Annotations,5" json:"Annotations"` }
var Constant_Type_DEFAULT *Type
var Field_Type_DEFAULT *Type
var Function_FunctionType_DEFAULT *Type
var Type_KeyType_DEFAULT *Type
var Type_ValueType_DEFAULT *Type
var Typedef_Type_DEFAULT *Type