thriftrw: go.uber.org/thriftrw/compile Index | Files

package compile

import "go.uber.org/thriftrw/compile"

Package compile provides specifications for the types and services defined in a Thrift file.

Files are parsed using the Compile method, which will return a Module that contains the types and services defined in the Thrift file.

Index

Package Files

annotation.go compiler.go constant.go constant_value.go container.go cycle.go doc.go enum.go error.go field.go module.go namespace.go once.go options.go primitive.go scope.go service.go string.go struct.go type.go typedef.go

type Annotations Uses

type Annotations map[string]string

Annotations maps annotations

type ArgsSpec Uses

type ArgsSpec FieldGroup

ArgsSpec contains information about a Function's arguments.

func (as ArgsSpec) Link(scope Scope) error

Link resolves references made by the ArgsSpec.

type BinarySpec Uses

type BinarySpec struct {
    Annotations Annotations
    // contains filtered or unexported fields
}

BinarySpec is the TypeSpec for binary types in a Thrift file.

func (*BinarySpec) ForEachTypeReference Uses

func (*BinarySpec) ForEachTypeReference(func(TypeSpec) error) error

ForEachTypeReference is a no-op for primitives.

func (t *BinarySpec) Link(Scope) (TypeSpec, error)

Link is a no-op for primitives.

func (*BinarySpec) ThriftAnnotations Uses

func (t *BinarySpec) ThriftAnnotations() Annotations

ThriftAnnotations returns the Thrift annotations specified with the reference to this type.

func (BinarySpec) ThriftFile Uses

func (BinarySpec) ThriftFile() string

func (*BinarySpec) ThriftName Uses

func (*BinarySpec) ThriftName() string

ThriftName returns "binary".

func (*BinarySpec) TypeCode Uses

func (*BinarySpec) TypeCode() wire.Type

TypeCode returns TBinary.

type BoolSpec Uses

type BoolSpec struct {
    Annotations Annotations
    // contains filtered or unexported fields
}

BoolSpec is the TypeSpec for bool types in a Thrift file.

func (*BoolSpec) ForEachTypeReference Uses

func (*BoolSpec) ForEachTypeReference(func(TypeSpec) error) error

ForEachTypeReference is a no-op for primitives.

func (t *BoolSpec) Link(Scope) (TypeSpec, error)

Link is a no-op for primitives.

func (*BoolSpec) ThriftAnnotations Uses

func (t *BoolSpec) ThriftAnnotations() Annotations

ThriftAnnotations returns the Thrift annotations specified with the reference to this type.

func (BoolSpec) ThriftFile Uses

func (BoolSpec) ThriftFile() string

func (*BoolSpec) ThriftName Uses

func (*BoolSpec) ThriftName() string

ThriftName returns "bool".

func (*BoolSpec) TypeCode Uses

func (*BoolSpec) TypeCode() wire.Type

TypeCode returns TBool.

type ConstReference Uses

type ConstReference struct {
    Target *Constant
}

ConstReference represents a reference to a 'const' declared in the Thrift file.

func (c ConstReference) Link(scope Scope, t TypeSpec) (ConstantValue, error)

Link for ConstReference.

type Constant Uses

type Constant struct {
    Name  string
    File  string
    Doc   string
    Type  TypeSpec
    Value ConstantValue
    // contains filtered or unexported fields
}

Constant represents a single named constant value from the Thrift file.

func (c *Constant) Link(scope Scope) (err error)

Link resolves any references made by the constant.

func (*Constant) String Uses

func (c *Constant) String() string

type ConstantBool Uses

type ConstantBool bool

ConstantBool represents a boolean constant from the Thrift file.

func (c ConstantBool) Link(scope Scope, t TypeSpec) (ConstantValue, error)

Link for ConstantBool

type ConstantDouble Uses

type ConstantDouble float64

ConstantDouble represents a double constant from the Thrift file.

func (c ConstantDouble) Link(scope Scope, t TypeSpec) (ConstantValue, error)

Link for ConstantDouble.

type ConstantInt Uses

type ConstantInt int64

ConstantInt represents an integer constant from the Thrift file.

func (c ConstantInt) Link(scope Scope, t TypeSpec) (ConstantValue, error)

Link for ConstantInt.

type ConstantList Uses

type ConstantList []ConstantValue

ConstantList represents a list of constant values from the Thrift file.

func (c ConstantList) Link(scope Scope, t TypeSpec) (ConstantValue, error)

Link for ConstantList.

type ConstantMap Uses

type ConstantMap []ConstantValuePair

ConstantMap represents a map literal from the Thrift file.

func (c ConstantMap) Link(scope Scope, t TypeSpec) (ConstantValue, error)

Link for ConstantMap.

type ConstantSet Uses

type ConstantSet []ConstantValue

ConstantSet represents a set of constant values from the Thrift file.

func (c ConstantSet) Link(scope Scope, t TypeSpec) (ConstantValue, error)

Link for ConstantSet.

type ConstantString Uses

type ConstantString string

ConstantString represents a string constant from the Thrift file.

func (c ConstantString) Link(scope Scope, t TypeSpec) (ConstantValue, error)

Link for ConstantString.

type ConstantStruct Uses

type ConstantStruct struct {
    Fields map[string]ConstantValue
}

ConstantStruct represents a struct literal from the Thrift file.

func (c *ConstantStruct) Link(scope Scope, t TypeSpec) (ConstantValue, error)

Link for ConstantStruct

type ConstantValue Uses

type ConstantValue interface {
    // Link the constant value with the given scope, casting it to the given
    // type if necessary.
    Link(scope Scope, t TypeSpec) (ConstantValue, error)
}

ConstantValue represents a compiled constant value or a reference to one.

type ConstantValuePair Uses

type ConstantValuePair struct {
    Key, Value ConstantValue
}

ConstantValuePair represents a key-value pair of ConstantValues in a constant map.

type DoubleSpec Uses

type DoubleSpec struct {
    Annotations Annotations
    // contains filtered or unexported fields
}

DoubleSpec is the TypeSpec for double types in a Thrift file.

func (*DoubleSpec) ForEachTypeReference Uses

func (*DoubleSpec) ForEachTypeReference(func(TypeSpec) error) error

ForEachTypeReference is a no-op for primitives.

func (t *DoubleSpec) Link(Scope) (TypeSpec, error)

Link is a no-op for primitives.

func (*DoubleSpec) ThriftAnnotations Uses

func (t *DoubleSpec) ThriftAnnotations() Annotations

ThriftAnnotations returns the Thrift annotations specified with the reference to this type.

func (DoubleSpec) ThriftFile Uses

func (DoubleSpec) ThriftFile() string

func (*DoubleSpec) ThriftName Uses

func (*DoubleSpec) ThriftName() string

ThriftName returns "double".

func (*DoubleSpec) TypeCode Uses

func (*DoubleSpec) TypeCode() wire.Type

TypeCode returns TDouble.

type EnumItem Uses

type EnumItem struct {
    Name        string
    Value       int32
    Annotations Annotations
    Doc         string
}

EnumItem is a single item inside an enum.

func (*EnumItem) ThriftAnnotations Uses

func (e *EnumItem) ThriftAnnotations() Annotations

ThriftAnnotations returns all associated annotations.

func (*EnumItem) ThriftName Uses

func (e *EnumItem) ThriftName() string

ThriftName for EnumItem

type EnumItemReference Uses

type EnumItemReference struct {
    Enum *EnumSpec
    Item *EnumItem
}

EnumItemReference represents a reference to an item of an enum defined in the THrift file.

func (e EnumItemReference) Link(scope Scope, t TypeSpec) (ConstantValue, error)

Link for EnumItemReference.

type EnumSpec Uses

type EnumSpec struct {
    Name        string
    File        string
    Items       []EnumItem
    Annotations Annotations
    Doc         string
}

EnumSpec represents an enum defined in the Thrift file.

func (*EnumSpec) ForEachTypeReference Uses

func (e *EnumSpec) ForEachTypeReference(func(TypeSpec) error) error

ForEachTypeReference for EnumSpec

func (e *EnumSpec) Link(scope Scope) (TypeSpec, error)

Link resolves any references made by the Enum.

func (*EnumSpec) LookupItem Uses

func (e *EnumSpec) LookupItem(name string) (*EnumItem, bool)

LookupItem retrieves the item with the given name from the enum.

Returns true or false indicating whether the result is valid or not.

func (*EnumSpec) ThriftAnnotations Uses

func (e *EnumSpec) ThriftAnnotations() Annotations

ThriftAnnotations returns all associated annotations.

func (*EnumSpec) ThriftFile Uses

func (e *EnumSpec) ThriftFile() string

ThriftFile for EnumSpec

func (*EnumSpec) ThriftName Uses

func (e *EnumSpec) ThriftName() string

ThriftName for EnumSpec

func (*EnumSpec) TypeCode Uses

func (e *EnumSpec) TypeCode() wire.Type

TypeCode for EnumSpec.

Enums are represented as i32 over the wire.

type FS Uses

type FS interface {
    // Read reads the file named by filename and returns the contents.
    // See: https://golang.org/pkg/io/ioutil/#ReadFile
    Read(filename string) ([]byte, error)
    // Abs returns an absolute representation of path.
    // See: https://golang.org/pkg/path/filepath/#Abs
    Abs(p string) (string, error)
}

FS is used by the compiler to interact with the filesystem.

type FieldGroup Uses

type FieldGroup []*FieldSpec

FieldGroup represents a collection of fields for struct-like types.

func (FieldGroup) FindByName Uses

func (fg FieldGroup) FindByName(name string) (*FieldSpec, error)

FindByName retrieves the FieldSpec for the field with the given name.

func (FieldGroup) ForEachTypeReference Uses

func (fg FieldGroup) ForEachTypeReference(f func(TypeSpec) error) error

ForEachTypeReference applies the given function on each TypeSpec in the FieldGroup.

func (fg FieldGroup) Link(scope Scope) error

Link resolves references made by fields inside the FieldGroup.

type FieldSpec Uses

type FieldSpec struct {
    ID          int16
    Name        string
    Type        TypeSpec
    Required    bool
    Doc         string
    Default     ConstantValue
    Annotations Annotations
}

FieldSpec represents a single field of a struct or parameter list.

func (f *FieldSpec) Link(scope Scope) (err error)

Link links together any references made by the FieldSpec.

func (*FieldSpec) ThriftAnnotations Uses

func (f *FieldSpec) ThriftAnnotations() Annotations

ThriftAnnotations returns all associated annotations.

func (*FieldSpec) ThriftName Uses

func (f *FieldSpec) ThriftName() string

ThriftName is the name of the FieldSpec as it appears in the Thrift file.

type FunctionSpec Uses

type FunctionSpec struct {
    Name        string
    ArgsSpec    ArgsSpec
    ResultSpec  *ResultSpec // nil if OneWay is true
    OneWay      bool
    Annotations Annotations
    // contains filtered or unexported fields
}

FunctionSpec is a single function inside a Service.

func (*FunctionSpec) CallType Uses

func (f *FunctionSpec) CallType() wire.EnvelopeType

CallType returns the envelope type that is used when making enveloped requests for this function.

func (f *FunctionSpec) Link(scope Scope) error

Link resolves any references made by the given function.

func (*FunctionSpec) MethodName Uses

func (f *FunctionSpec) MethodName() string

MethodName returns the method name for this function.

type I16Spec Uses

type I16Spec struct {
    Annotations Annotations
    // contains filtered or unexported fields
}

I16Spec is the TypeSpec for i16 types in a Thrift file.

func (*I16Spec) ForEachTypeReference Uses

func (*I16Spec) ForEachTypeReference(func(TypeSpec) error) error

ForEachTypeReference is a no-op for primitives.

func (t *I16Spec) Link(Scope) (TypeSpec, error)

Link is a no-op for primitives.

func (*I16Spec) ThriftAnnotations Uses

func (t *I16Spec) ThriftAnnotations() Annotations

ThriftAnnotations returns the Thrift annotations specified with the reference to this type.

func (I16Spec) ThriftFile Uses

func (I16Spec) ThriftFile() string

func (*I16Spec) ThriftName Uses

func (*I16Spec) ThriftName() string

ThriftName returns "i16".

func (*I16Spec) TypeCode Uses

func (*I16Spec) TypeCode() wire.Type

TypeCode returns TI16.

type I32Spec Uses

type I32Spec struct {
    Annotations Annotations
    // contains filtered or unexported fields
}

I32Spec is the TypeSpec for i32 types in a Thrift file.

func (*I32Spec) ForEachTypeReference Uses

func (*I32Spec) ForEachTypeReference(func(TypeSpec) error) error

ForEachTypeReference is a no-op for primitives.

func (t *I32Spec) Link(Scope) (TypeSpec, error)

Link is a no-op for primitives.

func (*I32Spec) ThriftAnnotations Uses

func (t *I32Spec) ThriftAnnotations() Annotations

ThriftAnnotations returns the Thrift annotations specified with the reference to this type.

func (I32Spec) ThriftFile Uses

func (I32Spec) ThriftFile() string

func (*I32Spec) ThriftName Uses

func (*I32Spec) ThriftName() string

ThriftName returns "i32".

func (*I32Spec) TypeCode Uses

func (*I32Spec) TypeCode() wire.Type

TypeCode returns TI32.

type I64Spec Uses

type I64Spec struct {
    Annotations Annotations
    // contains filtered or unexported fields
}

I64Spec is the TypeSpec for i64 types in a Thrift file.

func (*I64Spec) ForEachTypeReference Uses

func (*I64Spec) ForEachTypeReference(func(TypeSpec) error) error

ForEachTypeReference is a no-op for primitives.

func (t *I64Spec) Link(Scope) (TypeSpec, error)

Link is a no-op for primitives.

func (*I64Spec) ThriftAnnotations Uses

func (t *I64Spec) ThriftAnnotations() Annotations

ThriftAnnotations returns the Thrift annotations specified with the reference to this type.

func (I64Spec) ThriftFile Uses

func (I64Spec) ThriftFile() string

func (*I64Spec) ThriftName Uses

func (*I64Spec) ThriftName() string

ThriftName returns "i64".

func (*I64Spec) TypeCode Uses

func (*I64Spec) TypeCode() wire.Type

TypeCode returns TI64.

type I8Spec Uses

type I8Spec struct {
    Annotations Annotations
    // contains filtered or unexported fields
}

I8Spec is the TypeSpec for i8/byte types in a Thrift file.

func (*I8Spec) ForEachTypeReference Uses

func (*I8Spec) ForEachTypeReference(func(TypeSpec) error) error

ForEachTypeReference is a no-op for primitives.

func (t *I8Spec) Link(Scope) (TypeSpec, error)

Link is a no-op for primitives.

func (*I8Spec) ThriftAnnotations Uses

func (t *I8Spec) ThriftAnnotations() Annotations

ThriftAnnotations returns the Thrift annotations specified with the reference to this type.

func (I8Spec) ThriftFile Uses

func (I8Spec) ThriftFile() string

func (*I8Spec) ThriftName Uses

func (*I8Spec) ThriftName() string

ThriftName returns "byte".

func (*I8Spec) TypeCode Uses

func (*I8Spec) TypeCode() wire.Type

TypeCode returns TI8.

type IncludedModule Uses

type IncludedModule struct {
    Name   string
    Module *Module
}

IncludedModule represents an included module in the Thrift file.

The name of the IncludedModule is the name under which the module is exposed in the Thrift file which included it. This is usually the same as the Module name except when our custom include-as syntax is used.

type ListSpec Uses

type ListSpec struct {
    ValueSpec   TypeSpec
    Annotations Annotations
    // contains filtered or unexported fields
}

ListSpec represents lists of values of the same type.

func (*ListSpec) ForEachTypeReference Uses

func (l *ListSpec) ForEachTypeReference(f func(TypeSpec) error) error

ForEachTypeReference for ListSpec

func (l *ListSpec) Link(scope Scope) (TypeSpec, error)

Link resolves the type references in the ListSpec.

func (*ListSpec) ThriftAnnotations Uses

func (l *ListSpec) ThriftAnnotations() Annotations

ThriftAnnotations returns all associated annotations.

func (ListSpec) ThriftFile Uses

func (ListSpec) ThriftFile() string

func (*ListSpec) ThriftName Uses

func (l *ListSpec) ThriftName() string

ThriftName for ListSpec

func (*ListSpec) TypeCode Uses

func (l *ListSpec) TypeCode() wire.Type

TypeCode for ListSpec

type MapSpec Uses

type MapSpec struct {
    KeySpec, ValueSpec TypeSpec
    Annotations        Annotations
    // contains filtered or unexported fields
}

MapSpec represents a key-value mapping between two types.

func (*MapSpec) ForEachTypeReference Uses

func (m *MapSpec) ForEachTypeReference(f func(TypeSpec) error) error

ForEachTypeReference for MapSpec

func (m *MapSpec) Link(scope Scope) (TypeSpec, error)

Link resolves the type references in the MapSpec.

func (*MapSpec) ThriftAnnotations Uses

func (m *MapSpec) ThriftAnnotations() Annotations

ThriftAnnotations returns all associated annotations.

func (MapSpec) ThriftFile Uses

func (MapSpec) ThriftFile() string

func (*MapSpec) ThriftName Uses

func (m *MapSpec) ThriftName() string

ThriftName for MapSpec

func (*MapSpec) TypeCode Uses

func (m *MapSpec) TypeCode() wire.Type

TypeCode for MapSpec

type Module Uses

type Module struct {
    Name       string
    ThriftPath string

    Includes  map[string]*IncludedModule
    Constants map[string]*Constant
    Types     map[string]TypeSpec
    Services  map[string]*ServiceSpec

    Raw []byte // The raw IDL input.
}

Module represents a compiled Thrift module. It contains all information about all known types, constants, services, and includes from the Thrift file.

ThriftPath is the absolute path to the Thrift file from which this module was compiled. All includes made by the Thrift file are relative to that path.

The module name is usually just the basename of the ThriftPath.

func Compile Uses

func Compile(path string, opts ...Option) (*Module, error)

Compile parses and compiles the Thrift file at the given path and any other Thrift file it includes.

func (*Module) GetName Uses

func (m *Module) GetName() string

GetName for Module

func (*Module) LookupConstant Uses

func (m *Module) LookupConstant(name string) (*Constant, error)

LookupConstant for Module.

func (*Module) LookupInclude Uses

func (m *Module) LookupInclude(name string) (Scope, error)

LookupInclude for Module.

func (*Module) LookupService Uses

func (m *Module) LookupService(name string) (*ServiceSpec, error)

LookupService for Module.

func (*Module) LookupType Uses

func (m *Module) LookupType(name string) (TypeSpec, error)

LookupType for Module.

func (*Module) Walk Uses

func (m *Module) Walk(f func(*Module) error) error

Walk the module tree starting at the given module. This module and all its direct and transitive dependencies will be visited exactly once in an unspecified order. The walk will stop on the first error returned by `f`.

type NamedEntity Uses

type NamedEntity interface {
    // ThriftName is the name of the type as it appears in the Thrift file.
    ThriftName() string

    // ThriftAnnotations is the map of all associated annotations from the Thrift file.
    ThriftAnnotations() Annotations
}

NamedEntity is any Thrift entity with a name and annotations. Not all entities are TypeSpecs.

type Option Uses

type Option func(*compiler)

Option represents a compiler option.

func Filesystem Uses

func Filesystem(fs FS) Option

Filesystem controls how the Thrift compiler accesses the filesystem.

func NonStrict Uses

func NonStrict() Option

NonStrict disables strict validation of the Thrift file. This allows struct fields which are not marked as optional or required.

type ResultSpec Uses

type ResultSpec struct {
    ReturnType TypeSpec
    Exceptions FieldGroup
}

ResultSpec contains information about a Function's result type.

func (rs *ResultSpec) Link(scope Scope) (err error)

Link resolves any references made by the return type or exceptions in the ResultSpec.

type Scope Uses

type Scope interface {
    // GetName retrieves gets this scope.
    GetName() string

    // Retrieve a type defined in this scope.
    LookupType(name string) (TypeSpec, error)

    // Retrieve a service defined in this scope.
    LookupService(name string) (*ServiceSpec, error)

    // Retrieve a constant defined in this scope.
    LookupConstant(name string) (*Constant, error)

    // Retrieve an included scope.
    LookupInclude(name string) (Scope, error)
}

Scope represents a queryable compilation scope.

All Lookup methods must only return types defined in this scope. References to items defined in included modules will be resolved by the caller.

func EmptyScope Uses

func EmptyScope(name string) Scope

EmptyScope returns a Scope that fails all lookups.

type ServiceSpec Uses

type ServiceSpec struct {
    Name        string
    File        string
    Parent      *ServiceSpec
    Functions   map[string]*FunctionSpec
    Annotations Annotations
    // contains filtered or unexported fields
}

ServiceSpec is a collection of named functions.

func (s *ServiceSpec) Link(scope Scope) error

Link resolves any references made by the given service.

func (*ServiceSpec) ThriftFile Uses

func (s *ServiceSpec) ThriftFile() string

ThriftFile is the Thrift file in which this service was defined.

type SetSpec Uses

type SetSpec struct {
    ValueSpec   TypeSpec
    Annotations Annotations
    // contains filtered or unexported fields
}

SetSpec represents sets of values of the same type.

func (*SetSpec) ForEachTypeReference Uses

func (s *SetSpec) ForEachTypeReference(f func(TypeSpec) error) error

ForEachTypeReference for SetSpec

func (s *SetSpec) Link(scope Scope) (TypeSpec, error)

Link resolves the type references in the SetSpec.

func (*SetSpec) ThriftAnnotations Uses

func (s *SetSpec) ThriftAnnotations() Annotations

ThriftAnnotations returns all associated annotations.

func (SetSpec) ThriftFile Uses

func (SetSpec) ThriftFile() string

func (*SetSpec) ThriftName Uses

func (s *SetSpec) ThriftName() string

ThriftName for SetSpec.

func (*SetSpec) TypeCode Uses

func (s *SetSpec) TypeCode() wire.Type

TypeCode for SetSpec

type StringSpec Uses

type StringSpec struct {
    Annotations Annotations
    // contains filtered or unexported fields
}

StringSpec is the TypeSpec for string types in a Thrift file.

func (*StringSpec) ForEachTypeReference Uses

func (*StringSpec) ForEachTypeReference(func(TypeSpec) error) error

ForEachTypeReference is a no-op for primitives.

func (t *StringSpec) Link(Scope) (TypeSpec, error)

Link is a no-op for primitives.

func (*StringSpec) ThriftAnnotations Uses

func (t *StringSpec) ThriftAnnotations() Annotations

ThriftAnnotations returns the Thrift annotations specified with the reference to this type.

func (StringSpec) ThriftFile Uses

func (StringSpec) ThriftFile() string

func (*StringSpec) ThriftName Uses

func (*StringSpec) ThriftName() string

ThriftName returns "string".

func (*StringSpec) TypeCode Uses

func (*StringSpec) TypeCode() wire.Type

TypeCode returns TBinary since Thrift strings are sent as binary over the wire.

type StructSpec Uses

type StructSpec struct {
    Name        string
    File        string
    Type        ast.StructureType
    Fields      FieldGroup
    Doc         string
    Annotations Annotations
    // contains filtered or unexported fields
}

StructSpec represents a structure defined in the Thrift file.

func (*StructSpec) ForEachTypeReference Uses

func (s *StructSpec) ForEachTypeReference(f func(TypeSpec) error) error

ForEachTypeReference for StructSpec

func (*StructSpec) IsExceptionType Uses

func (s *StructSpec) IsExceptionType() bool

IsExceptionType returns true if the StructSpec represents an exception declaration.

func (s *StructSpec) Link(scope Scope) (TypeSpec, error)

Link links together all references in the StructSpec.

func (*StructSpec) ThriftAnnotations Uses

func (s *StructSpec) ThriftAnnotations() Annotations

ThriftAnnotations returns all associated annotations.

func (*StructSpec) ThriftFile Uses

func (s *StructSpec) ThriftFile() string

ThriftFile of the StructSpec.

func (*StructSpec) ThriftName Uses

func (s *StructSpec) ThriftName() string

ThriftName of the StructSpec.

func (*StructSpec) TypeCode Uses

func (s *StructSpec) TypeCode() wire.Type

TypeCode for structs.

type TypeSpec Uses

type TypeSpec interface {
    NamedEntity

    // Link resolves references to other types in this TypeSpecs to actual
    // TypeSpecs from the given Scope.
    Link(scope Scope) (TypeSpec, error)

    // TypeCode is the wire-level Thrift Type associated with this Type.
    TypeCode() wire.Type

    // ThriftFile is the path to the Thrift file in which this TypeSpec was
    // defined. This may be an empty string if this type is a native Thrift
    // type.
    ThriftFile() string

    // Applies the given function to each TypeSpec referenced by this
    // TypeSpec. This function MUST NOT be automatically called recursively on
    // the TypeSpecs referenced by the child TypeSpecs. The decision to make
    // that call is up to the caller of this function.
    //
    // Returns the first error returned by the function call or nil.
    ForEachTypeReference(func(TypeSpec) error) error
}

TypeSpec contains information about Thrift types.

func RootTypeSpec Uses

func RootTypeSpec(s TypeSpec) TypeSpec

RootTypeSpec returns the TypeSpec that the given linked TypeSpec points to.

For most types, this is the type itself. For Typedefs, it is the root TypeSpec of the Typedef's target.

type TypedefSpec Uses

type TypedefSpec struct {
    Name        string
    File        string
    Target      TypeSpec
    Annotations Annotations
    Doc         string
    // contains filtered or unexported fields
}

TypedefSpec represents an alias to another type in the Thrift file.

func (*TypedefSpec) ForEachTypeReference Uses

func (t *TypedefSpec) ForEachTypeReference(f func(TypeSpec) error) error

ForEachTypeReference for TypedefSpec

func (t *TypedefSpec) Link(scope Scope) (TypeSpec, error)

Link links the Target TypeSpec for this typedef in the given scope.

func (*TypedefSpec) ThriftAnnotations Uses

func (t *TypedefSpec) ThriftAnnotations() Annotations

ThriftAnnotations returns all associated annotations.

func (*TypedefSpec) ThriftFile Uses

func (t *TypedefSpec) ThriftFile() string

ThriftFile for TypedefSpec.

func (*TypedefSpec) ThriftName Uses

func (t *TypedefSpec) ThriftName() string

ThriftName is the name of the typedef as it appears in the Thrift file.

func (*TypedefSpec) TypeCode Uses

func (t *TypedefSpec) TypeCode() wire.Type

TypeCode gets the wire type for the typedef.

Package compile imports 11 packages (graph) and is imported by 17 packages. Updated 2020-01-10. Refresh now. Tools for package owners.