Documentation ¶
Index ¶
- type GenerationError
- type Generator
- func (g Generator) Imports() map[string]string
- func (g Generator) Methods() []Method
- func (g Generator) Name() string
- func (g Generator) Package() string
- func (g *Generator) SetInternal(inPkg bool)
- func (g *Generator) SetName(name string)
- func (g *Generator) SetPackage(name string)
- func (g *Generator) SetTemplate(tmpl string) error
- func (g Generator) Write(wr io.Writer) error
- type Method
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenerationError ¶
GenerationError is returned by Write when an error is encountered
func (GenerationError) CodeWithLineNumbers ¶
func (err GenerationError) CodeWithLineNumbers() string
CodeWithLineNumbers returns all the code including line numbers
func (GenerationError) Error ¶
func (err GenerationError) Error() string
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator produces code to mock an interface
func NewGenerator ¶
NewGenerator initializes a Generator that will mock the given interface from the specified package.
func (Generator) Methods ¶
Methods returns information about all the methods required to satisfy the interface
func (*Generator) SetInternal ¶
func (*Generator) SetPackage ¶
SetPackage changes the package containing the mock
func (*Generator) SetTemplate ¶
SetTemplate allows defining a different template to generate the mock. It will be parsed with text/template and execuded with the Generator.
type Method ¶
type Method struct {
// contains filtered or unexported fields
}
Method contains the details from an interface method
func (Method) ParamTypes ¶
ParamTypes returns the list of types for the params
func (Method) ReturnTypes ¶
ReturnTypes returns the list of types for the params