package
1.2.4
Repository: https://github.com/ccheers/xpkg.git
Documentation: pkg.go.dev

# README

mockgen

import "github.com/ccheers/xpkg/testing/internal/cmd/testgen/mockgen"

Index

func SourceMode

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

SourceMode generates mocks via source file.

type Generator

Generator to generate mock file

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

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

GeneratorOption change the Generator Option

type GeneratorOption func(g *Generator)

func OptGeneratorFilename

func OptGeneratorFilename(filename string) GeneratorOption

OptGeneratorFilename change the Generator Prop of filename

Generated by gomarkdoc

# Functions

NewGenerator return a Generator Point.
OptGeneratorFilename change the Generator Prop of filename.
SourceMode generates mocks via source file.

# Structs

Generator to generate mock file.

# Type aliases

GeneratorOption change the Generator Option.