model - ActiveState ActiveGo 1.8
...

Package model

import "github.com/golang/mock/mockgen/model"
Overview
Index

Overview ▾

Package model contains the data model necessary for generating mock implementations.

type ArrayType

ArrayType is an array or slice type.

type ArrayType struct {
    Len  int // -1 for slices, >= 0 for arrays
    Type Type
}

func (*ArrayType) String

func (at *ArrayType) String(pm map[string]string, pkgOverride string) string

type ChanDir

ChanDir is a channel direction.

type ChanDir int
const (
    RecvDir ChanDir = 1
    SendDir ChanDir = 2
)

type ChanType

ChanType is a channel type.

type ChanType struct {
    Dir  ChanDir // 0, 1 or 2
    Type Type
}

func (*ChanType) String

func (ct *ChanType) String(pm map[string]string, pkgOverride string) string

type FuncType

FuncType is a function type.

type FuncType struct {
    In, Out  []*Parameter
    Variadic *Parameter // may be nil
}

func (*FuncType) String

func (ft *FuncType) String(pm map[string]string, pkgOverride string) string

type Interface

Interface is a Go interface.

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

func InterfaceFromInterfaceType

func InterfaceFromInterfaceType(it reflect.Type) (*Interface, error)

func (*Interface) Print

func (intf *Interface) Print(w io.Writer)

type MapType

MapType is a map type.

type MapType struct {
    Key, Value Type
}

func (*MapType) String

func (mt *MapType) String(pm map[string]string, pkgOverride string) string

type Method

Method is a single method of an interface.

type Method struct {
    Name     string
    In, Out  []*Parameter
    Variadic *Parameter // may be nil
}

func (*Method) Print

func (m *Method) Print(w io.Writer)

type NamedType

NamedType is an exported type in a package.

type NamedType struct {
    Package string // may be empty
    Type    string // TODO: should this be typed Type?
}

func (*NamedType) String

func (nt *NamedType) String(pm map[string]string, pkgOverride string) string

type Package

Package is a Go package. It may be a subset.

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

func (*Package) Imports

func (pkg *Package) Imports() map[string]bool

Imports returns the imports needed by the Package as a set of import paths.

func (*Package) Print

func (pkg *Package) Print(w io.Writer)

type Parameter

Parameter is an argument or return parameter of a method.

type Parameter struct {
    Name string // may be empty
    Type Type
}

func (*Parameter) Print

func (p *Parameter) Print(w io.Writer)

type PointerType

PointerType is a pointer to another type.

type PointerType struct {
    Type Type
}

func (*PointerType) String

func (pt *PointerType) String(pm map[string]string, pkgOverride string) string

type PredeclaredType

PredeclaredType is a predeclared type such as "int".

type PredeclaredType string

func (PredeclaredType) String

func (pt PredeclaredType) String(pm map[string]string, pkgOverride string) string

type Type

Type is a Go type.

type Type interface {
    String(pm map[string]string, pkgOverride string) string
    // contains filtered or unexported methods
}