ErrorInterface represent built-in error interface.
var ErrorInterface = Interface{ Name: "error", Methods: []*Method{ { Name: "Error", Out: []*Parameter{ { Name: "", Type: PredeclaredType("string"), }, }, }, }, }
ArrayType is an array or slice type.
type ArrayType struct { Len int // -1 for slices, >= 0 for arrays Type Type }
func (at *ArrayType) String(pm map[string]string, pkgOverride string) string
ChanDir is a channel direction.
type ChanDir int
Constants for channel directions.
const ( RecvDir ChanDir = 1 SendDir ChanDir = 2 )
ChanType is a channel type.
type ChanType struct { Dir ChanDir // 0, 1 or 2 Type Type }
func (ct *ChanType) String(pm map[string]string, pkgOverride string) string
FuncType is a function type.
type FuncType struct { In, Out []*Parameter Variadic *Parameter // may be nil }
func (ft *FuncType) String(pm map[string]string, pkgOverride string) string
Interface is a Go interface.
type Interface struct { Name string Methods []*Method TypeParams []*Parameter }
func InterfaceFromInterfaceType(it reflect.Type) (*Interface, error)
InterfaceFromInterfaceType returns a pointer to an interface for the given reflection interface type.
func (intf *Interface) AddMethod(m *Method)
AddMethod adds a new method, de-duplicating by method name.
func (intf *Interface) Print(w io.Writer)
Print writes the interface name and its methods.
MapType is a map type.
type MapType struct { Key, Value Type }
func (mt *MapType) String(pm map[string]string, pkgOverride string) string
Method is a single method of an interface.
type Method struct { Name string In, Out []*Parameter Variadic *Parameter // may be nil }
func (m *Method) Print(w io.Writer)
Print writes the method name and its signature.
NamedType is an exported type in a package.
type NamedType struct { Package string // may be empty Type string TypeParams *TypeParametersType }
func (nt *NamedType) String(pm map[string]string, pkgOverride string) string
Package is a Go package. It may be a subset.
type Package struct { Name string PkgPath string Interfaces []*Interface DotImports []string }
func (pkg *Package) Imports() map[string]bool
Imports returns the imports needed by the Package as a set of import paths.
func (pkg *Package) Print(w io.Writer)
Print writes the package name and its exported interfaces.
Parameter is an argument or return parameter of a method.
type Parameter struct { Name string // may be empty Type Type }
func (p *Parameter) Print(w io.Writer)
Print writes a method parameter.
PointerType is a pointer to another type.
type PointerType struct { Type Type }
func (pt *PointerType) String(pm map[string]string, pkgOverride string) string
PredeclaredType is a predeclared type such as "int".
type PredeclaredType string
func (pt PredeclaredType) String(map[string]string, string) string
Type is a Go type.
type Type interface { String(pm map[string]string, pkgOverride string) string // contains filtered or unexported methods }
TypeParametersType contains type paramters for a NamedType.
type TypeParametersType struct { TypeParameters []Type }
func (tp *TypeParametersType) String(pm map[string]string, pkgOverride string) string