mockgen

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SourceMode

func SourceMode(source string) (*model.Package, error)

SourceMode generates mocks via source file.

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator to generate mock file

func NewGenerator

func NewGenerator(generatorOptions ...GeneratorOption) *Generator

NewGenerator return a Generator Point

func (*Generator) Generate

func (g *Generator) Generate(pkg *model.Package, outputPkgName string, outputPackagePath string) error

Generate gen the mock file

func (*Generator) GenerateMockInterface

func (g *Generator) GenerateMockInterface(intf *model.Interface, outputPackagePath string) error

GenerateMockInterface ...

func (*Generator) GenerateMockMethod

func (g *Generator) GenerateMockMethod(mockType string, m *model.Method, pkgOverride string) error

GenerateMockMethod generates a mock method implementation. If non-empty, pkgOverride is the package in which unqualified types reside.

func (*Generator) GenerateMockMethods

func (g *Generator) GenerateMockMethods(mockType string, intf *model.Interface, pkgOverride string)

GenerateMockMethods ...

func (*Generator) GenerateMockRecorderMethod

func (g *Generator) GenerateMockRecorderMethod(mockType string, m *model.Method) error

GenerateMockRecorderMethod ...

func (*Generator) Output

func (g *Generator) Output() []byte

Output returns the Generator's output, formatted in the standard Go style.

type GeneratorOption

type GeneratorOption func(g *Generator)

GeneratorOption change the Generator Option

func OptGeneratorFilename

func OptGeneratorFilename(filename string) GeneratorOption

OptGeneratorFilename change the Generator Prop of filename

Jump to

Keyboard shortcuts

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