parser

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2021 License: Apache-2.0 Imports: 10 Imported by: 41 modules, 65 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

View Source
const NOTSET = -999999

NOTSET is a value to express 'not set'.

Variables

View Source
var ConstTypedValue_Double_DEFAULT float64
View Source
var ConstTypedValue_Identifier_DEFAULT string
View Source
var ConstTypedValue_Int_DEFAULT int64
View Source
var ConstTypedValue_List_DEFAULT []*ConstValue
View Source
var ConstTypedValue_Literal_DEFAULT string
View Source
var ConstTypedValue_Map_DEFAULT []*MapConstValue

Functions

func CircleDetect

func CircleDetect(ast *Thrift) string

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

func Typename2TypeID(name string) uint8

Typename2TypeID converts a TypeID name to its value.

Types

type ConstType

type ConstType int64
const (
	ConstType_ConstDouble     ConstType = 0
	ConstType_ConstInt        ConstType = 1
	ConstType_ConstLiteral    ConstType = 2
	ConstType_ConstIdentifier ConstType = 3
	ConstType_ConstList       ConstType = 4
	ConstType_ConstMap        ConstType = 5
)

func ConstTypeFromString

func ConstTypeFromString(s string) (ConstType, error)

func ConstTypePtr

func ConstTypePtr(v ConstType) *ConstType

func (*ConstType) Scan

func (p *ConstType) Scan(value interface{}) error

func (ConstType) String

func (p ConstType) String() string

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) Read

func (p *ConstTypedValue) Read(iprot thrift.TProtocol) error

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

func (*ConstTypedValue) Write

func (p *ConstTypedValue) Write(oprot thrift.TProtocol) error

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) Read

func (p *ConstValue) Read(iprot thrift.TProtocol) error

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

func (*ConstValue) Write

func (p *ConstValue) Write(oprot thrift.TProtocol) error

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 (p *Constant) GetAnnotations() map[string]string

func (*Constant) GetName

func (p *Constant) GetName() string

func (*Constant) GetType

func (p *Constant) GetType() *Type

func (*Constant) GetValue

func (p *Constant) GetValue() *ConstValue

func (*Constant) IsSetType

func (p *Constant) IsSetType() bool

func (*Constant) IsSetValue

func (p *Constant) IsSetValue() bool

func (*Constant) Read

func (p *Constant) Read(iprot thrift.TProtocol) error

func (*Constant) ReadField1

func (p *Constant) ReadField1(iprot thrift.TProtocol) error

func (*Constant) ReadField2

func (p *Constant) ReadField2(iprot thrift.TProtocol) error

func (*Constant) ReadField3

func (p *Constant) ReadField3(iprot thrift.TProtocol) error

func (*Constant) ReadField4

func (p *Constant) ReadField4(iprot thrift.TProtocol) error

func (*Constant) String

func (p *Constant) String() string

func (*Constant) Write

func (p *Constant) Write(oprot thrift.TProtocol) error

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 NewEnum

func NewEnum() *Enum

func (*Enum) GetAnnotations

func (p *Enum) GetAnnotations() map[string]string

func (*Enum) GetName

func (p *Enum) GetName() string

func (*Enum) GetValues

func (p *Enum) GetValues() []*EnumValue

func (*Enum) Read

func (p *Enum) Read(iprot thrift.TProtocol) error

func (*Enum) ReadField1

func (p *Enum) ReadField1(iprot thrift.TProtocol) error

func (*Enum) ReadField2

func (p *Enum) ReadField2(iprot thrift.TProtocol) error

func (*Enum) ReadField3

func (p *Enum) ReadField3(iprot thrift.TProtocol) error

func (*Enum) String

func (p *Enum) String() string

func (*Enum) Write

func (p *Enum) Write(oprot thrift.TProtocol) error

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

func (p *EnumValue) GetAnnotations() map[string]string

func (*EnumValue) GetName

func (p *EnumValue) GetName() string

func (*EnumValue) GetValue

func (p *EnumValue) GetValue() int64

func (*EnumValue) Read

func (p *EnumValue) Read(iprot thrift.TProtocol) error

func (*EnumValue) ReadField1

func (p *EnumValue) ReadField1(iprot thrift.TProtocol) error

func (*EnumValue) ReadField2

func (p *EnumValue) ReadField2(iprot thrift.TProtocol) error

func (*EnumValue) ReadField3

func (p *EnumValue) ReadField3(iprot thrift.TProtocol) error

func (*EnumValue) String

func (p *EnumValue) String() string

func (*EnumValue) Write

func (p *EnumValue) Write(oprot thrift.TProtocol) error

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 NewField

func NewField() *Field

func (*Field) GetAnnotations

func (p *Field) GetAnnotations() map[string]string

func (*Field) GetDefault

func (p *Field) GetDefault() *ConstValue

func (*Field) GetID

func (p *Field) GetID() int32

func (*Field) GetName

func (p *Field) GetName() string

func (*Field) GetRequiredness

func (p *Field) GetRequiredness() FieldType

func (*Field) GetType

func (p *Field) GetType() *Type

func (*Field) IsSetDefault

func (p *Field) IsSetDefault() bool

func (*Field) IsSetType

func (p *Field) IsSetType() bool

func (*Field) Read

func (p *Field) Read(iprot thrift.TProtocol) error

func (*Field) ReadField1

func (p *Field) ReadField1(iprot thrift.TProtocol) error

func (*Field) ReadField2

func (p *Field) ReadField2(iprot thrift.TProtocol) error

func (*Field) ReadField3

func (p *Field) ReadField3(iprot thrift.TProtocol) error

func (*Field) ReadField4

func (p *Field) ReadField4(iprot thrift.TProtocol) error

func (*Field) ReadField5

func (p *Field) ReadField5(iprot thrift.TProtocol) error

func (*Field) ReadField6

func (p *Field) ReadField6(iprot thrift.TProtocol) error

func (*Field) String

func (p *Field) String() string

func (*Field) Write

func (p *Field) Write(oprot thrift.TProtocol) error

type FieldType

type FieldType int64
const (
	FieldType_Default  FieldType = 0
	FieldType_Required FieldType = 1
	FieldType_Optional FieldType = 2
)

func FieldTypeFromString

func FieldTypeFromString(s string) (FieldType, error)

func FieldTypePtr

func FieldTypePtr(v FieldType) *FieldType

func (*FieldType) Scan

func (p *FieldType) Scan(value interface{}) error

func (FieldType) String

func (p FieldType) String() string

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 (p *Function) GetAnnotations() map[string]string

func (*Function) GetArguments

func (p *Function) GetArguments() []*Field

func (*Function) GetFunctionType

func (p *Function) GetFunctionType() *Type

func (*Function) GetName

func (p *Function) GetName() string

func (*Function) GetOneway

func (p *Function) GetOneway() bool

func (*Function) GetThrows

func (p *Function) GetThrows() []*Field

func (*Function) GetVoid

func (p *Function) GetVoid() bool

func (*Function) IsSetFunctionType

func (p *Function) IsSetFunctionType() bool

func (*Function) Read

func (p *Function) Read(iprot thrift.TProtocol) error

func (*Function) ReadField1

func (p *Function) ReadField1(iprot thrift.TProtocol) error

func (*Function) ReadField2

func (p *Function) ReadField2(iprot thrift.TProtocol) error

func (*Function) ReadField3

func (p *Function) ReadField3(iprot thrift.TProtocol) error

func (*Function) ReadField4

func (p *Function) ReadField4(iprot thrift.TProtocol) error

func (*Function) ReadField5

func (p *Function) ReadField5(iprot thrift.TProtocol) error

func (*Function) ReadField6

func (p *Function) ReadField6(iprot thrift.TProtocol) error

func (*Function) ReadField7

func (p *Function) ReadField7(iprot thrift.TProtocol) error

func (*Function) String

func (p *Function) String() string

func (*Function) Write

func (p *Function) Write(oprot thrift.TProtocol) error

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) GetPath

func (p *Include) GetPath() string

func (*Include) GetReference

func (p *Include) GetReference() *Thrift

func (*Include) IsSetReference

func (p *Include) IsSetReference() bool

func (*Include) Read

func (p *Include) Read(iprot thrift.TProtocol) error

func (*Include) ReadField1

func (p *Include) ReadField1(iprot thrift.TProtocol) error

func (*Include) ReadField2

func (p *Include) ReadField2(iprot thrift.TProtocol) error

func (*Include) String

func (p *Include) String() string

func (*Include) Write

func (p *Include) Write(oprot thrift.TProtocol) error

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) Read

func (p *MapConstValue) Read(iprot thrift.TProtocol) error

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

func (*MapConstValue) Write

func (p *MapConstValue) Write(oprot thrift.TProtocol) error

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 (p *Namespace) GetAnnotations() map[string]string

func (*Namespace) GetLanguage

func (p *Namespace) GetLanguage() string

func (*Namespace) GetName

func (p *Namespace) GetName() string

func (*Namespace) Read

func (p *Namespace) Read(iprot thrift.TProtocol) error

func (*Namespace) ReadField1

func (p *Namespace) ReadField1(iprot thrift.TProtocol) error

func (*Namespace) ReadField2

func (p *Namespace) ReadField2(iprot thrift.TProtocol) error

func (*Namespace) ReadField3

func (p *Namespace) ReadField3(iprot thrift.TProtocol) error

func (*Namespace) String

func (p *Namespace) String() string

func (*Namespace) Write

func (p *Namespace) Write(oprot thrift.TProtocol) error

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 (p *Service) GetAnnotations() map[string]string

func (*Service) GetExtends

func (p *Service) GetExtends() string

func (*Service) GetFunctions

func (p *Service) GetFunctions() []*Function

func (*Service) GetName

func (p *Service) GetName() string

func (*Service) Read

func (p *Service) Read(iprot thrift.TProtocol) error

func (*Service) ReadField1

func (p *Service) ReadField1(iprot thrift.TProtocol) error

func (*Service) ReadField2

func (p *Service) ReadField2(iprot thrift.TProtocol) error

func (*Service) ReadField3

func (p *Service) ReadField3(iprot thrift.TProtocol) error

func (*Service) ReadField4

func (p *Service) ReadField4(iprot thrift.TProtocol) error

func (*Service) String

func (p *Service) String() string

func (*Service) Write

func (p *Service) Write(oprot thrift.TProtocol) error

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) Read

func (p *StructLike) Read(iprot thrift.TProtocol) error

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

func (*StructLike) Write

func (p *StructLike) Write(oprot thrift.TProtocol) error

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 NewThrift

func NewThrift() *Thrift

func ParseFile

func ParseFile(path string, includeDirs []string, recursive bool) (*Thrift, error)

ParseFile parses a thrift file and returns an AST. If recursive is true, then the include IDLs are parsed recursively as well.

func ParseString

func ParseString(path, content string) (*Thrift, error)

ParseString parses the thrift file path and file content then return an AST.

func (*Thrift) DepthFirstSearch

func (t *Thrift) DepthFirstSearch() chan *Thrift

DepthFirstSearch returns a channal providing Thrift ASTs in a depth-first order without duplication. Unparsed references will be ignored.

func (*Thrift) GetConstant

func (t *Thrift) GetConstant(name string) (*Constant, bool)

GetConstant returns a Constant node that mathces the name.

func (*Thrift) GetConstants

func (p *Thrift) GetConstants() []*Constant

func (*Thrift) GetCppIncludes

func (p *Thrift) GetCppIncludes() []string

func (*Thrift) GetEnum

func (t *Thrift) GetEnum(name string) (*Enum, bool)

GetEnum returns an Enum node that matches the name.

func (*Thrift) GetEnums

func (p *Thrift) GetEnums() []*Enum

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 (p *Thrift) GetFilename() string

func (*Thrift) GetIncludes

func (p *Thrift) GetIncludes() []*Include

func (*Thrift) GetNamespace

func (t *Thrift) GetNamespace(lang string) (ns string, found bool)

GetNamespace returns a namespace for the language. When both "*" and the language have a namespace defined, the latter is prefered.

func (*Thrift) GetNamespaceOrReferenceName

func (t *Thrift) GetNamespaceOrReferenceName(lang string) string

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 (p *Thrift) GetNamespaces() []*Namespace

func (*Thrift) GetReference

func (t *Thrift) GetReference(refname string) (*Thrift, bool)

GetReference return a AST that matches the given name. References should be initialized before calling this method.

func (*Thrift) GetService

func (t *Thrift) GetService(name string) (*Service, bool)

GetService returns a Service node that matches the name.

func (*Thrift) GetServices

func (p *Thrift) GetServices() []*Service

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

func (t *Thrift) GetTypedef(alias string) (*Typedef, bool)

GetTypedef returns a Typedef node that matches the alias name.

func (*Thrift) GetTypedefs

func (p *Thrift) GetTypedefs() []*Typedef

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

func (*Thrift) Read

func (p *Thrift) Read(iprot thrift.TProtocol) error

func (*Thrift) ReadField1

func (p *Thrift) ReadField1(iprot thrift.TProtocol) error

func (*Thrift) ReadField2

func (p *Thrift) ReadField2(iprot thrift.TProtocol) error

func (*Thrift) ReadField3

func (p *Thrift) ReadField3(iprot thrift.TProtocol) error

func (*Thrift) ReadField4

func (p *Thrift) ReadField4(iprot thrift.TProtocol) error

func (*Thrift) ReadField5

func (p *Thrift) ReadField5(iprot thrift.TProtocol) error

func (*Thrift) ReadField6

func (p *Thrift) ReadField6(iprot thrift.TProtocol) error

func (*Thrift) ReadField7

func (p *Thrift) ReadField7(iprot thrift.TProtocol) error

func (*Thrift) ReadField8

func (p *Thrift) ReadField8(iprot thrift.TProtocol) error

func (*Thrift) ReadField9

func (p *Thrift) ReadField9(iprot thrift.TProtocol) error

func (*Thrift) ReadField10

func (p *Thrift) ReadField10(iprot thrift.TProtocol) error

func (*Thrift) ReadField11

func (p *Thrift) ReadField11(iprot thrift.TProtocol) error

func (*Thrift) String

func (p *Thrift) String() string

func (*Thrift) Write

func (p *Thrift) Write(oprot thrift.TProtocol) error

type ThriftIDL

type ThriftIDL struct {
	Buffer string

	Parse  func(rule ...int) error
	Reset  func()
	Pretty bool
	// contains filtered or unexported fields
}

func (*ThriftIDL) AST

func (t *ThriftIDL) AST() *node32

func (*ThriftIDL) Add

func (t *ThriftIDL) Add(rule pegRule, begin, end, depth uint32, index int)

func (*ThriftIDL) Error

func (t *ThriftIDL) Error() []token32

func (*ThriftIDL) Expand

func (t *ThriftIDL) Expand(index int)

func (*ThriftIDL) Highlighter

func (p *ThriftIDL) Highlighter()

func (*ThriftIDL) Init

func (p *ThriftIDL) Init()

func (*ThriftIDL) Order

func (t *ThriftIDL) Order() [][]token32

func (*ThriftIDL) PreOrder

func (t *ThriftIDL) PreOrder() (<-chan state32, [][]token32)

func (*ThriftIDL) Print

func (t *ThriftIDL) Print()

func (*ThriftIDL) PrintSyntax

func (t *ThriftIDL) PrintSyntax()

func (*ThriftIDL) PrintSyntaxTree

func (p *ThriftIDL) PrintSyntaxTree()

func (*ThriftIDL) Tokens

func (t *ThriftIDL) Tokens() <-chan token32

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

func NewType

func NewType() *Type

func (*Type) GetAnnotations

func (p *Type) GetAnnotations() map[string]string

func (*Type) GetCppType

func (p *Type) GetCppType() string

func (*Type) GetKeyType

func (p *Type) GetKeyType() *Type

func (*Type) GetName

func (p *Type) GetName() string

func (*Type) GetValueType

func (p *Type) GetValueType() *Type

func (*Type) IsSetKeyType

func (p *Type) IsSetKeyType() bool

func (*Type) IsSetValueType

func (p *Type) IsSetValueType() bool

func (*Type) Read

func (p *Type) Read(iprot thrift.TProtocol) error

func (*Type) ReadField1

func (p *Type) ReadField1(iprot thrift.TProtocol) error

func (*Type) ReadField2

func (p *Type) ReadField2(iprot thrift.TProtocol) error

func (*Type) ReadField3

func (p *Type) ReadField3(iprot thrift.TProtocol) error

func (*Type) ReadField4

func (p *Type) ReadField4(iprot thrift.TProtocol) error

func (*Type) ReadField5

func (p *Type) ReadField5(iprot thrift.TProtocol) error

func (*Type) String

func (t *Type) String() string

func (*Type) Write

func (p *Type) Write(oprot thrift.TProtocol) error

type Typedef

type Typedef struct {
	Type *Type `thrift:"Type,1" json:"Type,omitempty"`

	Alias string `thrift:"Alias,2" json:"Alias"`

	Annotations map[string]string `thrift:"Annotations,3" json:"Annotations"`
}

func NewTypedef

func NewTypedef() *Typedef

func (*Typedef) GetAlias

func (p *Typedef) GetAlias() string

func (*Typedef) GetAnnotations

func (p *Typedef) GetAnnotations() map[string]string

func (*Typedef) GetType

func (p *Typedef) GetType() *Type

func (*Typedef) IsSetType

func (p *Typedef) IsSetType() bool

func (*Typedef) Read

func (p *Typedef) Read(iprot thrift.TProtocol) error

func (*Typedef) ReadField1

func (p *Typedef) ReadField1(iprot thrift.TProtocol) error

func (*Typedef) ReadField2

func (p *Typedef) ReadField2(iprot thrift.TProtocol) error

func (*Typedef) ReadField3

func (p *Typedef) ReadField3(iprot thrift.TProtocol) error

func (*Typedef) String

func (p *Typedef) String() string

func (*Typedef) Write

func (p *Typedef) Write(oprot thrift.TProtocol) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL