imocker

package
v0.0.0-...-b8770ff Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTemplate

func GenerateTemplate(mock Mock) (string, error)

GenerateTemplate compiles the template and generates a mock

Types

type Method

type Method struct {
	NamedParams    []NamedParam
	NamedReturns   []NamedParam
	UnNamedParams  []string
	UnNamedReturns []string
	HasReturns     bool
}

Method describes a method's parameters and return values

type Mock

type Mock struct {
	Package string
	Name    string
	Methods map[string]Method
}

Mock describes an interface and its methods which will be used to generate a mock structure

func ParseMock

func ParseMock(reader io.Reader) ([]Mock, error)

ParseMock reads a Go source file and builds a Mock object through parsing the file's AST

type NamedParam

type NamedParam struct {
	Name string
	Type string
}

NamedParam describes a parameter or return value's variable name and type definition as a string

Jump to

Keyboard shortcuts

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