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.
Code generated by peg. DO NOT EDIT.
Index ¶
- Constants
- Variables
- func CircleDetect(ast *Thrift) string
- func Pretty(pretty bool) func(*ThriftIDL) error
- func Size(size int) func(*ThriftIDL) error
- func Typename2TypeID(name string) uint8
- type Annotation
- func (p *Annotation) GetKey() (v string)
- func (p *Annotation) GetValues() (v []string)
- func (p *Annotation) Read(iprot thrift.TProtocol) (err error)
- func (p *Annotation) ReadField1(iprot thrift.TProtocol) error
- func (p *Annotation) ReadField2(iprot thrift.TProtocol) error
- func (p *Annotation) String() string
- func (p *Annotation) Write(oprot thrift.TProtocol) (err error)
- type Annotations
- type Category
- func (p Category) IsBaseType() bool
- func (p Category) IsBinary() bool
- func (p Category) IsBool() bool
- func (p Category) IsByte() bool
- func (p Category) IsConstant() bool
- func (p Category) IsContainerType() bool
- func (p Category) IsDouble() bool
- func (p Category) IsEnum() bool
- func (p Category) IsException() bool
- func (p Category) IsI16() bool
- func (p Category) IsI32() bool
- func (p Category) IsI64() bool
- func (p Category) IsList() bool
- func (p Category) IsMap() bool
- func (p Category) IsService() bool
- func (p Category) IsSet() bool
- func (p Category) IsString() bool
- func (p Category) IsStruct() bool
- func (p Category) IsStructLike() bool
- func (p Category) IsTypedef() bool
- func (p Category) IsUnion() bool
- func (p *Category) Scan(value interface{}) (err error)
- func (p Category) String() string
- func (p *Category) Value() (driver.Value, error)
- type ConstType
- type ConstTypedValue
- func (p *ConstTypedValue) CountSetFieldsConstTypedValue() int
- func (p *ConstTypedValue) GetDouble() (v float64)
- func (p *ConstTypedValue) GetIdentifier() (v string)
- func (p *ConstTypedValue) GetInt() (v int64)
- func (p *ConstTypedValue) GetList() (v []*ConstValue)
- func (p *ConstTypedValue) GetLiteral() (v string)
- func (p *ConstTypedValue) GetMap() (v []*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) (err 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) (err error)
- type ConstValue
- func (p *ConstValue) GetExtra() (v *ConstValueExtra)
- func (p *ConstValue) GetType() (v ConstType)
- func (p *ConstValue) GetTypedValue() (v *ConstTypedValue)
- func (p *ConstValue) IsSetExtra() bool
- func (p *ConstValue) IsSetTypedValue() bool
- func (p *ConstValue) Read(iprot thrift.TProtocol) (err error)
- func (p *ConstValue) ReadField1(iprot thrift.TProtocol) error
- func (p *ConstValue) ReadField2(iprot thrift.TProtocol) error
- func (p *ConstValue) ReadField3(iprot thrift.TProtocol) error
- func (t *ConstValue) String() string
- func (p *ConstValue) Write(oprot thrift.TProtocol) (err error)
- type ConstValueExtra
- func (p *ConstValueExtra) GetIndex() (v int32)
- func (p *ConstValueExtra) GetIsEnum() (v bool)
- func (p *ConstValueExtra) GetName() (v string)
- func (p *ConstValueExtra) GetSel() (v string)
- func (p *ConstValueExtra) Read(iprot thrift.TProtocol) (err error)
- func (p *ConstValueExtra) ReadField1(iprot thrift.TProtocol) error
- func (p *ConstValueExtra) ReadField2(iprot thrift.TProtocol) error
- func (p *ConstValueExtra) ReadField3(iprot thrift.TProtocol) error
- func (p *ConstValueExtra) ReadField4(iprot thrift.TProtocol) error
- func (p *ConstValueExtra) String() string
- func (p *ConstValueExtra) Write(oprot thrift.TProtocol) (err error)
- type Constant
- func (p *Constant) GetAnnotations() (v Annotations)
- func (p *Constant) GetName() (v string)
- func (p *Constant) GetReservedComments() (v string)
- func (p *Constant) GetType() (v *Type)
- func (p *Constant) GetValue() (v *ConstValue)
- func (p *Constant) IsSetType() bool
- func (p *Constant) IsSetValue() bool
- func (p *Constant) Read(iprot thrift.TProtocol) (err 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) ReadField5(iprot thrift.TProtocol) error
- func (p *Constant) String() string
- func (p *Constant) Write(oprot thrift.TProtocol) (err error)
- type Enum
- func (p *Enum) GetAnnotations() (v Annotations)
- func (p *Enum) GetName() (v string)
- func (p *Enum) GetReservedComments() (v string)
- func (p *Enum) GetValues() (v []*EnumValue)
- func (p *Enum) Read(iprot thrift.TProtocol) (err 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) ReadField4(iprot thrift.TProtocol) error
- func (p *Enum) String() string
- func (p *Enum) Write(oprot thrift.TProtocol) (err error)
- type EnumValue
- func (p *EnumValue) GetAnnotations() (v Annotations)
- func (p *EnumValue) GetName() (v string)
- func (p *EnumValue) GetReservedComments() (v string)
- func (p *EnumValue) GetValue() (v int64)
- func (p *EnumValue) Read(iprot thrift.TProtocol) (err 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) ReadField4(iprot thrift.TProtocol) error
- func (p *EnumValue) String() string
- func (p *EnumValue) Write(oprot thrift.TProtocol) (err error)
- type Field
- func (p *Field) GetAnnotations() (v Annotations)
- func (p *Field) GetDefault() (v *ConstValue)
- func (p *Field) GetID() (v int32)
- func (p *Field) GetName() (v string)
- func (p *Field) GetRequiredness() (v FieldType)
- func (p *Field) GetReservedComments() (v string)
- func (p *Field) GetType() (v *Type)
- func (p *Field) IsSetDefault() bool
- func (p *Field) IsSetType() bool
- func (p *Field) Read(iprot thrift.TProtocol) (err 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) ReadField7(iprot thrift.TProtocol) error
- func (p *Field) String() string
- func (p *Field) Write(oprot thrift.TProtocol) (err error)
- type FieldType
- type Function
- func (p *Function) ForEachArgument(f func(v *Field) bool)
- func (p *Function) ForEachThrow(f func(v *Field) bool)
- func (p *Function) GetAnnotations() (v Annotations)
- func (p *Function) GetArguments() (v []*Field)
- func (p *Function) GetFunctionType() (v *Type)
- func (p *Function) GetName() (v string)
- func (p *Function) GetOneway() (v bool)
- func (p *Function) GetReservedComments() (v string)
- func (p *Function) GetThrows() (v []*Field)
- func (p *Function) GetVoid() (v bool)
- func (p *Function) IsSetFunctionType() bool
- func (p *Function) Read(iprot thrift.TProtocol) (err 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) ReadField8(iprot thrift.TProtocol) error
- func (p *Function) String() string
- func (p *Function) Write(oprot thrift.TProtocol) (err error)
- type Include
- func (p *Include) GetPath() (v string)
- func (p *Include) GetReference() (v *Thrift)
- func (p *Include) GetUsed() (v bool)
- func (p *Include) IsSetReference() bool
- func (p *Include) IsSetUsed() bool
- func (p *Include) Read(iprot thrift.TProtocol) (err error)
- func (p *Include) ReadField1(iprot thrift.TProtocol) error
- func (p *Include) ReadField2(iprot thrift.TProtocol) error
- func (p *Include) ReadField3(iprot thrift.TProtocol) error
- func (p *Include) String() string
- func (p *Include) Write(oprot thrift.TProtocol) (err error)
- type MapConstValue
- func (p *MapConstValue) GetKey() (v *ConstValue)
- func (p *MapConstValue) GetValue() (v *ConstValue)
- func (p *MapConstValue) IsSetKey() bool
- func (p *MapConstValue) IsSetValue() bool
- func (p *MapConstValue) Read(iprot thrift.TProtocol) (err 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) (err error)
- type Namespace
- func (p *Namespace) GetAnnotations() (v Annotations)
- func (p *Namespace) GetLanguage() (v string)
- func (p *Namespace) GetName() (v string)
- func (p *Namespace) Read(iprot thrift.TProtocol) (err 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) (err error)
- type Reference
- func (p *Reference) GetIndex() (v int32)
- func (p *Reference) GetName() (v string)
- func (p *Reference) Read(iprot thrift.TProtocol) (err error)
- func (p *Reference) ReadField1(iprot thrift.TProtocol) error
- func (p *Reference) ReadField2(iprot thrift.TProtocol) error
- func (p *Reference) String() string
- func (p *Reference) Write(oprot thrift.TProtocol) (err error)
- type Service
- func (s *Service) ForEachFunction(f func(v *Function) bool)
- func (p *Service) GetAnnotations() (v Annotations)
- func (p *Service) GetExtends() (v string)
- func (p *Service) GetFunctions() (v []*Function)
- func (p *Service) GetName() (v string)
- func (p *Service) GetReference() (v *Reference)
- func (p *Service) GetReservedComments() (v string)
- func (p *Service) IsSetReference() bool
- func (p *Service) Read(iprot thrift.TProtocol) (err 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) ReadField5(iprot thrift.TProtocol) error
- func (p *Service) ReadField6(iprot thrift.TProtocol) error
- func (p *Service) String() string
- func (p *Service) Write(oprot thrift.TProtocol) (err error)
- type StructLike
- func (s *StructLike) ForEachField(f func(v *Field) bool)
- func (p *StructLike) GetAnnotations() (v Annotations)
- func (p *StructLike) GetCategory() (v string)
- func (s *StructLike) GetField(name string) (*Field, bool)
- func (p *StructLike) GetFields() (v []*Field)
- func (p *StructLike) GetName() (v string)
- func (p *StructLike) GetReservedComments() (v string)
- func (p *StructLike) Read(iprot thrift.TProtocol) (err 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) ReadField5(iprot thrift.TProtocol) error
- func (p *StructLike) String() string
- func (p *StructLike) Write(oprot thrift.TProtocol) (err error)
- type Thrift
- func (t *Thrift) DepthFirstSearch() chan *Thrift
- func (t *Thrift) ForEachConstant(f func(v *Constant) bool)
- func (t *Thrift) ForEachEnum(f func(v *Enum) bool)
- func (t *Thrift) ForEachException(f func(v *StructLike) bool)
- func (t *Thrift) ForEachInclude(f func(v *Include) bool)
- func (t *Thrift) ForEachNamepace(f func(v *Namespace) bool)
- func (t *Thrift) ForEachService(f func(v *Service) bool)
- func (t *Thrift) ForEachStruct(f func(v *StructLike) bool)
- func (t *Thrift) ForEachStructLike(f func(v *StructLike) bool)
- func (t *Thrift) ForEachTypedef(f func(v *Typedef) bool)
- func (t *Thrift) ForEachUnion(f func(v *StructLike) bool)
- func (t *Thrift) GetConstant(name string) (*Constant, bool)
- func (p *Thrift) GetConstants() (v []*Constant)
- func (p *Thrift) GetCppIncludes() (v []string)
- func (t *Thrift) GetEnum(name string) (*Enum, bool)
- func (p *Thrift) GetEnums() (v []*Enum)
- func (t *Thrift) GetException(name string) (*StructLike, bool)
- func (p *Thrift) GetExceptions() (v []*StructLike)
- func (p *Thrift) GetFilename() (v string)
- func (p *Thrift) GetIncludes() (v []*Include)
- func (p *Thrift) GetName2Category() (v map[string]Category)
- func (t *Thrift) GetNamespace(lang string) (ns string, found bool)
- func (t *Thrift) GetNamespaceOrReferenceName(lang string) string
- func (p *Thrift) GetNamespaces() (v []*Namespace)
- func (t *Thrift) GetReference(refname string) (*Thrift, bool)
- func (t *Thrift) GetService(name string) (*Service, bool)
- func (p *Thrift) GetServices() (v []*Service)
- func (t *Thrift) GetStruct(name string) (*StructLike, bool)
- func (t *Thrift) GetStructLikes() (ss []*StructLike)
- func (p *Thrift) GetStructs() (v []*StructLike)
- func (t *Thrift) GetTypedef(alias string) (*Typedef, bool)
- func (p *Thrift) GetTypedefs() (v []*Typedef)
- func (t *Thrift) GetUnion(name string) (*StructLike, bool)
- func (p *Thrift) GetUnions() (v []*StructLike)
- func (p *Thrift) Read(iprot thrift.TProtocol) (err 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) ReadField12(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) (err error)
- type ThriftIDL
- func (t *ThriftIDL) AST() *node32
- func (t *ThriftIDL) Add(rule pegRule, begin, end, index uint32)
- func (p *ThriftIDL) Init(options ...func(*ThriftIDL) error) error
- func (p *ThriftIDL) Parse(rule ...int) error
- func (t *ThriftIDL) PrettyPrintSyntaxTree(buffer string)
- func (t *ThriftIDL) Print()
- func (p *ThriftIDL) PrintSyntaxTree()
- func (p *ThriftIDL) Reset()
- func (p *ThriftIDL) SprintSyntaxTree() string
- func (t *ThriftIDL) Tokens() []token32
- func (t *ThriftIDL) Trim(length uint32)
- func (p *ThriftIDL) WriteSyntaxTree(w io.Writer)
- type Type
- func (p *Type) GetAnnotations() (v Annotations)
- func (p *Type) GetCategory() (v Category)
- func (p *Type) GetCppType() (v string)
- func (p *Type) GetIsTypedef() (v bool)
- func (p *Type) GetKeyType() (v *Type)
- func (p *Type) GetName() (v string)
- func (p *Type) GetReference() (v *Reference)
- func (p *Type) GetValueType() (v *Type)
- func (p *Type) IsSetIsTypedef() bool
- func (p *Type) IsSetKeyType() bool
- func (p *Type) IsSetReference() bool
- func (p *Type) IsSetValueType() bool
- func (p *Type) Read(iprot thrift.TProtocol) (err 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 (p *Type) ReadField6(iprot thrift.TProtocol) error
- func (p *Type) ReadField7(iprot thrift.TProtocol) error
- func (p *Type) ReadField8(iprot thrift.TProtocol) error
- func (t *Type) String() string
- func (p *Type) Write(oprot thrift.TProtocol) (err error)
- type Typedef
- func (p *Typedef) GetAlias() (v string)
- func (p *Typedef) GetAnnotations() (v Annotations)
- func (p *Typedef) GetReservedComments() (v string)
- func (p *Typedef) GetType() (v *Type)
- func (p *Typedef) IsSetType() bool
- func (p *Typedef) Read(iprot thrift.TProtocol) (err 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) ReadField4(iprot thrift.TProtocol) error
- func (p *Typedef) String() string
- func (p *Typedef) Write(oprot thrift.TProtocol) (err 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
var Include_Used_DEFAULT bool
var Type_IsTypedef_DEFAULT bool
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 Annotation ¶ added in v0.1.2
type Annotation struct { Key string `thrift:"Key,1" json:"Key"` Values []string `thrift:"Values,2" json:"Values"` }
func NewAnnotation ¶ added in v0.1.2
func NewAnnotation() *Annotation
func (*Annotation) GetKey ¶ added in v0.1.2
func (p *Annotation) GetKey() (v string)
func (*Annotation) GetValues ¶ added in v0.1.2
func (p *Annotation) GetValues() (v []string)
func (*Annotation) Read ¶ added in v0.1.2
func (p *Annotation) Read(iprot thrift.TProtocol) (err error)
func (*Annotation) ReadField1 ¶ added in v0.1.2
func (p *Annotation) ReadField1(iprot thrift.TProtocol) error
func (*Annotation) ReadField2 ¶ added in v0.1.2
func (p *Annotation) ReadField2(iprot thrift.TProtocol) error
func (*Annotation) String ¶ added in v0.1.2
func (p *Annotation) String() string
type Annotations ¶ added in v0.1.2
type Annotations []*Annotation
func (*Annotations) Append ¶ added in v0.1.2
func (a *Annotations) Append(key string, value string)
Append append key value pair to Annotation slice.
func (*Annotations) Get ¶ added in v0.1.2
func (a *Annotations) Get(key string) []string
Get return annotations values.
type Category ¶ added in v0.1.2
type Category int64
const ( Category_Constant Category = 0 Category_Bool Category = 1 Category_Byte Category = 2 Category_I16 Category = 3 Category_I32 Category = 4 Category_I64 Category = 5 Category_Double Category = 6 Category_String Category = 7 Category_Binary Category = 8 Category_Map Category = 9 Category_List Category = 10 Category_Set Category = 11 Category_Enum Category = 12 Category_Struct Category = 13 Category_Union Category = 14 Category_Exception Category = 15 Category_Typedef Category = 16 Category_Service Category = 17 )
func CategoryFromString ¶ added in v0.1.2
func CategoryPtr ¶ added in v0.1.2
func (Category) IsBaseType ¶ added in v0.1.2
IsBaseType tells if the category is one of the basetypes.
func (Category) IsConstant ¶ added in v0.1.2
IsConstant tells if the category is constant.
func (Category) IsContainerType ¶ added in v0.1.2
IsContainerType tells if the category is one of the container types.
func (Category) IsException ¶ added in v0.1.2
IsException tells if the category is exception.
func (Category) IsStructLike ¶ added in v0.1.2
IsStructLike tells if the category is a struct-like.
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() (v float64)
func (*ConstTypedValue) GetIdentifier ¶
func (p *ConstTypedValue) GetIdentifier() (v string)
func (*ConstTypedValue) GetInt ¶
func (p *ConstTypedValue) GetInt() (v int64)
func (*ConstTypedValue) GetList ¶
func (p *ConstTypedValue) GetList() (v []*ConstValue)
func (*ConstTypedValue) GetLiteral ¶
func (p *ConstTypedValue) GetLiteral() (v string)
func (*ConstTypedValue) GetMap ¶
func (p *ConstTypedValue) GetMap() (v []*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"` Extra *ConstValueExtra `thrift:"Extra,3" json:"Extra,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) GetExtra ¶ added in v0.1.2
func (p *ConstValue) GetExtra() (v *ConstValueExtra)
func (*ConstValue) GetType ¶
func (p *ConstValue) GetType() (v ConstType)
func (*ConstValue) GetTypedValue ¶
func (p *ConstValue) GetTypedValue() (v *ConstTypedValue)
func (*ConstValue) IsSetExtra ¶ added in v0.1.2
func (p *ConstValue) IsSetExtra() bool
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) ReadField3 ¶ added in v0.1.2
func (p *ConstValue) ReadField3(iprot thrift.TProtocol) error
func (*ConstValue) String ¶
func (t *ConstValue) String() string
type ConstValueExtra ¶ added in v0.1.2
type ConstValueExtra struct { IsEnum bool `thrift:"IsEnum,1" json:"IsEnum"` Index int32 `thrift:"Index,2" json:"Index"` Name string `thrift:"Name,3" json:"Name"` Sel string `thrift:"Sel,4" json:"Sel"` }
var ConstValue_Extra_DEFAULT *ConstValueExtra
func NewConstValueExtra ¶ added in v0.1.2
func NewConstValueExtra() *ConstValueExtra
func (*ConstValueExtra) GetIndex ¶ added in v0.1.2
func (p *ConstValueExtra) GetIndex() (v int32)
func (*ConstValueExtra) GetIsEnum ¶ added in v0.1.2
func (p *ConstValueExtra) GetIsEnum() (v bool)
func (*ConstValueExtra) GetName ¶ added in v0.1.2
func (p *ConstValueExtra) GetName() (v string)
func (*ConstValueExtra) GetSel ¶ added in v0.1.2
func (p *ConstValueExtra) GetSel() (v string)
func (*ConstValueExtra) Read ¶ added in v0.1.2
func (p *ConstValueExtra) Read(iprot thrift.TProtocol) (err error)
func (*ConstValueExtra) ReadField1 ¶ added in v0.1.2
func (p *ConstValueExtra) ReadField1(iprot thrift.TProtocol) error
func (*ConstValueExtra) ReadField2 ¶ added in v0.1.2
func (p *ConstValueExtra) ReadField2(iprot thrift.TProtocol) error
func (*ConstValueExtra) ReadField3 ¶ added in v0.1.2
func (p *ConstValueExtra) ReadField3(iprot thrift.TProtocol) error
func (*ConstValueExtra) ReadField4 ¶ added in v0.1.2
func (p *ConstValueExtra) ReadField4(iprot thrift.TProtocol) error
func (*ConstValueExtra) String ¶ added in v0.1.2
func (p *ConstValueExtra) 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 Annotations `thrift:"Annotations,4" json:"Annotations"` ReservedComments string `thrift:"ReservedComments,5" json:"ReservedComments"` }
func NewConstant ¶
func NewConstant() *Constant
func (*Constant) GetAnnotations ¶
func (p *Constant) GetAnnotations() (v Annotations)
func (*Constant) GetReservedComments ¶ added in v0.1.3
func (*Constant) GetValue ¶
func (p *Constant) GetValue() (v *ConstValue)
func (*Constant) IsSetValue ¶
func (*Constant) ReadField5 ¶ added in v0.1.3
type Enum ¶
type Enum struct { Name string `thrift:"Name,1" json:"Name"` Values []*EnumValue `thrift:"Values,2" json:"Values"` Annotations Annotations `thrift:"Annotations,3" json:"Annotations"` ReservedComments string `thrift:"ReservedComments,4" json:"ReservedComments"` }
func (*Enum) GetAnnotations ¶
func (p *Enum) GetAnnotations() (v Annotations)
func (*Enum) GetReservedComments ¶ added in v0.1.3
type EnumValue ¶
type EnumValue struct { Name string `thrift:"Name,1" json:"Name"` Value int64 `thrift:"Value,2" json:"Value"` Annotations Annotations `thrift:"Annotations,3" json:"Annotations"` ReservedComments string `thrift:"ReservedComments,4" json:"ReservedComments"` }
func NewEnumValue ¶
func NewEnumValue() *EnumValue
func (*EnumValue) GetAnnotations ¶
func (p *EnumValue) GetAnnotations() (v Annotations)
func (*EnumValue) GetReservedComments ¶ added in v0.1.4
func (*EnumValue) ReadField4 ¶ added in v0.1.4
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 Annotations `thrift:"Annotations,6" json:"Annotations"` ReservedComments string `thrift:"ReservedComments,7" json:"ReservedComments"` }
func (*Field) GetAnnotations ¶
func (p *Field) GetAnnotations() (v Annotations)
func (*Field) GetDefault ¶
func (p *Field) GetDefault() (v *ConstValue)
func (*Field) GetRequiredness ¶
func (*Field) GetReservedComments ¶ added in v0.1.3
func (*Field) IsSetDefault ¶
type FieldType ¶
type FieldType int64
func FieldTypeFromString ¶
func FieldTypePtr ¶
func (FieldType) IsOptional ¶ added in v0.1.2
IsOptional tells whether a field type is optional.
func (FieldType) IsRequired ¶ added in v0.1.2
IsRequired tells whether a field type is required.
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 Annotations `thrift:"Annotations,7" json:"Annotations"` ReservedComments string `thrift:"ReservedComments,8" json:"ReservedComments"` }
func NewFunction ¶
func NewFunction() *Function
func (*Function) ForEachArgument ¶ added in v0.1.2
ForEachArgument calls f on each argument of the current function.
func (*Function) ForEachThrow ¶ added in v0.1.2
ForEachThrow calls f on each throw of the current function.
func (*Function) GetAnnotations ¶
func (p *Function) GetAnnotations() (v Annotations)
func (*Function) GetArguments ¶
func (*Function) GetFunctionType ¶
func (*Function) GetReservedComments ¶ added in v0.1.3
func (*Function) IsSetFunctionType ¶
func (*Function) ReadField8 ¶ added in v0.1.3
type Include ¶
type Include struct { Path string `thrift:"Path,1" json:"Path"` Reference *Thrift `thrift:"Reference,2" json:"Reference,omitempty"` Used *bool `thrift:"Used,3" json:"Used,omitempty"` }
func NewInclude ¶
func NewInclude() *Include
func (*Include) GetReference ¶
func (*Include) IsSetReference ¶
func (*Include) ReadField3 ¶ added in v0.1.2
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() (v *ConstValue)
func (*MapConstValue) GetValue ¶
func (p *MapConstValue) GetValue() (v *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 Annotations `thrift:"Annotations,3" json:"Annotations"` }
func NewNamespace ¶
func NewNamespace() *Namespace
func (*Namespace) GetAnnotations ¶
func (p *Namespace) GetAnnotations() (v Annotations)
func (*Namespace) GetLanguage ¶
type Reference ¶ added in v0.1.2
type Reference struct { Name string `thrift:"Name,1" json:"Name"` Index int32 `thrift:"Index,2" json:"Index"` }
var Service_Reference_DEFAULT *Reference
var Type_Reference_DEFAULT *Reference
func NewReference ¶ added in v0.1.2
func NewReference() *Reference
func (*Reference) ReadField1 ¶ added in v0.1.2
func (*Reference) ReadField2 ¶ added in v0.1.2
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 Annotations `thrift:"Annotations,4" json:"Annotations"` Reference *Reference `thrift:"Reference,5" json:"Reference,omitempty"` ReservedComments string `thrift:"ReservedComments,6" json:"ReservedComments"` }
func NewService ¶
func NewService() *Service
func (*Service) ForEachFunction ¶ added in v0.1.2
ForEachFunction calls f on each function in the current service.
func (*Service) GetAnnotations ¶
func (p *Service) GetAnnotations() (v Annotations)
func (*Service) GetExtends ¶
func (*Service) GetFunctions ¶
func (*Service) GetReference ¶ added in v0.1.2
func (*Service) GetReservedComments ¶ added in v0.1.3
func (*Service) IsSetReference ¶ added in v0.1.2
func (*Service) ReadField5 ¶ added in v0.1.2
func (*Service) ReadField6 ¶ added in v0.1.3
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 Annotations `thrift:"Annotations,4" json:"Annotations"` ReservedComments string `thrift:"ReservedComments,5" json:"ReservedComments"` }
func NewStructLike ¶
func NewStructLike() *StructLike
func (*StructLike) ForEachField ¶ added in v0.1.2
func (s *StructLike) ForEachField(f func(v *Field) bool)
ForEachField calls f on each field of the current struct-like.
func (*StructLike) GetAnnotations ¶
func (p *StructLike) GetAnnotations() (v Annotations)
func (*StructLike) GetCategory ¶
func (p *StructLike) GetCategory() (v string)
func (*StructLike) GetField ¶
func (s *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() (v []*Field)
func (*StructLike) GetName ¶
func (p *StructLike) GetName() (v string)
func (*StructLike) GetReservedComments ¶ added in v0.1.3
func (p *StructLike) GetReservedComments() (v 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) ReadField5 ¶ added in v0.1.3
func (p *StructLike) ReadField5(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"` Name2Category map[string]Category `thrift:"Name2Category,12" json:"Name2Category"` }
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) ForEachConstant ¶ added in v0.1.2
ForEachConstant calls f on each constant in the current AST.
func (*Thrift) ForEachEnum ¶ added in v0.1.2
ForEachEnum calls f on each enum in the current AST.
func (*Thrift) ForEachException ¶ added in v0.1.2
func (t *Thrift) ForEachException(f func(v *StructLike) bool)
ForEachException calls f on each exception in the current AST.
func (*Thrift) ForEachInclude ¶ added in v0.1.2
ForEachInclude calls f on each include of the current AST.
func (*Thrift) ForEachNamepace ¶ added in v0.1.2
ForEachNamepace calls f on each namespace of the current AST.
func (*Thrift) ForEachService ¶ added in v0.1.2
ForEachService calls f on each service in the current AST.
func (*Thrift) ForEachStruct ¶ added in v0.1.2
func (t *Thrift) ForEachStruct(f func(v *StructLike) bool)
ForEachStruct calls f on each struct in the current AST.
func (*Thrift) ForEachStructLike ¶ added in v0.1.2
func (t *Thrift) ForEachStructLike(f func(v *StructLike) bool)
ForEachStructLike calls f on each struct-like in the current AST.
func (*Thrift) ForEachTypedef ¶ added in v0.1.2
ForEachTypedef calls f on each typedef in the current AST.
func (*Thrift) ForEachUnion ¶ added in v0.1.2
func (t *Thrift) ForEachUnion(f func(v *StructLike) bool)
ForEachUnion calls f on each union in the current AST.
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() (v []*StructLike)
func (*Thrift) GetFilename ¶
func (*Thrift) GetIncludes ¶
func (*Thrift) GetName2Category ¶ added in v0.1.2
func (*Thrift) GetNamespace ¶
GetNamespace returns a namespace for the language. When both "*" and the language have a namespace defined, the latter is preferred.
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) GetStructLikes ¶ added in v0.1.2
func (t *Thrift) GetStructLikes() (ss []*StructLike)
GetStructLikes returns all struct-like definitions in the AST.
func (*Thrift) GetStructs ¶
func (p *Thrift) GetStructs() (v []*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() (v []*StructLike)
func (*Thrift) ReadField12 ¶ added in v0.1.2
type ThriftIDL ¶
func (*ThriftIDL) PrettyPrintSyntaxTree ¶ added in v0.1.3
func (t *ThriftIDL) PrettyPrintSyntaxTree(buffer string)
func (*ThriftIDL) PrintSyntaxTree ¶
func (p *ThriftIDL) PrintSyntaxTree()
func (*ThriftIDL) SprintSyntaxTree ¶ added in v0.1.3
func (*ThriftIDL) WriteSyntaxTree ¶ added in v0.1.3
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 Annotations `thrift:"Annotations,5" json:"Annotations"` Category Category `thrift:"Category,6" json:"Category"` Reference *Reference `thrift:"Reference,7" json:"Reference,omitempty"` IsTypedef *bool `thrift:"IsTypedef,8" json:"IsTypedef,omitempty"` }
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
func (*Type) GetAnnotations ¶
func (p *Type) GetAnnotations() (v Annotations)
func (*Type) GetCategory ¶ added in v0.1.2
func (*Type) GetCppType ¶
func (*Type) GetIsTypedef ¶ added in v0.1.2
func (*Type) GetKeyType ¶
func (*Type) GetReference ¶ added in v0.1.2
func (*Type) GetValueType ¶
func (*Type) IsSetIsTypedef ¶ added in v0.1.2
func (*Type) IsSetKeyType ¶
func (*Type) IsSetReference ¶ added in v0.1.2
func (*Type) IsSetValueType ¶
type Typedef ¶
type Typedef struct { Type *Type `thrift:"Type,1" json:"Type,omitempty"` Alias string `thrift:"Alias,2" json:"Alias"` Annotations Annotations `thrift:"Annotations,3" json:"Annotations"` ReservedComments string `thrift:"ReservedComments,4" json:"ReservedComments"` }
func NewTypedef ¶
func NewTypedef() *Typedef
func (*Typedef) GetAnnotations ¶
func (p *Typedef) GetAnnotations() (v Annotations)