template

package
v0.0.0-...-92440b6 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	PkgName         string
	SrcPkgQualifier string
	Imports         []*registry.Package
	Mocks           []MockData
	StubImpl        bool
	SkipEnsure      bool
}

Data is the template data used to render the Moq template.

func (Data) MocksSomeMethod

func (d Data) MocksSomeMethod() bool

MocksSomeMethod returns true of any one of the Mocks has at least 1 method.

type MethodData

type MethodData struct {
	Name    string
	Params  []ParamData
	Returns []ParamData
}

MethodData is the data which represents a method on some interface.

func (MethodData) ArgCallList

func (m MethodData) ArgCallList() string

ArgCallList is the string representation of method call parameters, ex: 's, n, foo'. In case of a last variadic parameter, it will be of the format 's, n, foos...'

func (MethodData) ArgList

func (m MethodData) ArgList() string

ArgList is the string representation of method parameters, ex: 's string, n int, foo bar.Baz'.

func (MethodData) ReturnArgNameList

func (m MethodData) ReturnArgNameList() string

ReturnArgNameList is the string representation of values being returned from the method, ex: 'foo', 's, err'.

func (MethodData) ReturnArgTypeList

func (m MethodData) ReturnArgTypeList() string

ReturnArgTypeList is the string representation of method return types, ex: 'bar.Baz', '(string, error)'.

type MockData

type MockData struct {
	InterfaceName string
	MockName      string
	Methods       []MethodData
}

MockData is the data used to generate a mock for some interface.

type ParamData

type ParamData struct {
	Var      *registry.Var
	Variadic bool
}

ParamData is the data which represents a parameter to some method of an interface.

func (ParamData) CallName

func (p ParamData) CallName() string

CallName returns the string representation of the parameter to be used for a method call. For a variadic paramter, it will be of the format 'foos...'.

func (ParamData) MethodArg

func (p ParamData) MethodArg() string

MethodArg is the representation of the parameter in the function signature, ex: 'name a.Type'.

func (ParamData) Name

func (p ParamData) Name() string

Name returns the name of the parameter.

func (ParamData) TypeString

func (p ParamData) TypeString() string

TypeString returns the string representation of the type of the parameter.

Jump to

Keyboard shortcuts

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