wrapgen

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2017 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIteratorComplete = errors.New("iterator complete")

ErrIteratorComplete is used to check for when the iterator has exhausted.

Functions

This section is empty.

Types

type Import

type Import struct {
	Package string
	Path    string
}

Import is a package name and path that is imported by another package.

type Interface

type Interface struct {
	Name    string
	Methods []*Method
}

Interface is an exported interface defined in a package.

type InterfaceIterator

type InterfaceIterator interface {
	Next() (string, *ast.InterfaceType, error)
}

InterfaceIterator scans a file and produces ast.InterfaceType nodes.

func NewInterfaceIterator

func NewInterfaceIterator(source *ast.File) InterfaceIterator

NewInterfaceIterator consumes the ast File object and produces an iterator for the contents.

type InterfaceMapper

type InterfaceMapper interface {
	Map(InterfaceIterator) map[string]*ast.InterfaceType
}

InterfaceMapper converts and InterfaceIterator into a map of name -> *ast.InterfaceType.

func NewInterfaceMapper

func NewInterfaceMapper() InterfaceMapper

NewInterfaceMapper generates a default implementation of the InterfaceMapper.

type Method

type Method struct {
	Name string
	In   []*Parameter
	Out  []*Parameter
}

Method is a named function attached to an interface.

type Package

type Package struct {
	Name       string
	Interfaces []*Interface
	Imports    []*Import
}

Package is a container for all exported interfaces of a Google-golang package.

type PackageParser

type PackageParser interface {
	ParsePackage(path string) (*Package, error)
}

PackageParser consumes an absolute path to a valid Google-golang package directory and generates a parsed Package object from it.

func NewParser

func NewParser() PackageParser

NewParser generates a PackageParser using the default implementation.

type Parameter

type Parameter struct {
	Name string
	Type Type
}

Parameter is a named parameter used by a Method.

type Type

type Type interface {
	String() string
}

Type is a Google-golang type definition that can be rendered into a valid Google-golang code snippet.

type TypeArray

type TypeArray struct {
	Len  int
	Type Type
}

TypeArray is a slice or array type.

func (*TypeArray) String

func (t *TypeArray) String() string

type TypeBuiltin

type TypeBuiltin string

TypeBuiltin is a built in Google-golang type such as "string" or "bool".

func (TypeBuiltin) String

func (t TypeBuiltin) String() string

type TypeChan

type TypeChan struct {
	ReadOnly  bool
	WriteOnly bool
	Type      Type
}

TypeChan is a channel type.

func (*TypeChan) String

func (t *TypeChan) String() string

type TypeExported

type TypeExported struct {
	Package string
	Type    Type
}

TypeExported is a user defined type that is exported from a package.

func (*TypeExported) String

func (t *TypeExported) String() string

type TypeFunc

type TypeFunc struct {
	In  []Type
	Out []Type
}

TypeFunc is an input type of a function.

func (*TypeFunc) String

func (t *TypeFunc) String() string

type TypeMap

type TypeMap struct {
	Key   Type
	Value Type
}

TypeMap is a user defined map type.

func (*TypeMap) String

func (t *TypeMap) String() string

type TypePointer

type TypePointer struct {
	Type Type
}

TypePointer is a pointer to another type.

func (*TypePointer) String

func (t *TypePointer) String() string

type TypeVariadic

type TypeVariadic struct {
	Type Type
}

TypeVariadic is any type that is prefixed by Ellipsis.

func (*TypeVariadic) String

func (t *TypeVariadic) String() string

Jump to

Keyboard shortcuts

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