Documentation ¶
Index ¶
- func CleanImports(f *ast.File, cleanedImports []gosyntax.ImportSpec) []gosyntax.ImportSpec
- func GenerateFuncMock(writer io.Writer, mockPkg string, mockClz string, fnName string, ...)
- func GetPackageImports(pkg *packages.Package) []gosyntax.ImportSpec
- func LookupInPackageScope(pkg *packages.Package, name string) types.Object
- func MockFunc(writer io.Writer, mockPkg string, mockClz string, fset *token.FileSet, ...)
- func SetImportSpecs(f *ast.File, imports []*ast.ImportSpec)
- func WriteFuncDecls(writer io.Writer, fset *token.FileSet, file *ast.File)
- func WriteFuncWithLocalOverrides(writer io.Writer, fset *token.FileSet, fnSpec *ast.FuncDecl, ...)
- func WriteImportDecls(writer io.Writer, imports []gosyntax.ImportSpec)
- type ReturnFieldBinding
- type ReturnFieldBindingSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanImports ¶
func CleanImports(f *ast.File, cleanedImports []gosyntax.ImportSpec) []gosyntax.ImportSpec
func GenerateFuncMock ¶ added in v0.1.9
func GenerateFuncMock( writer io.Writer, mockPkg string, mockClz string, fnName string, paramInfos []*gosyntax.FieldDeclInfo, returnInfos []*gosyntax.FieldDeclInfo, signature *types.Signature, )
GenerateFuncMock generates function mock implementation based on FieldDeclInfo abstraction
func GetPackageImports ¶
func GetPackageImports(pkg *packages.Package) []gosyntax.ImportSpec
func LookupInPackageScope ¶
func MockFunc ¶ added in v0.1.9
func MockFunc( writer io.Writer, mockPkg string, mockClz string, fset *token.FileSet, fnName string, fnParams *ast.FieldList, fnReturns *ast.FieldList, signature *types.Signature, )
MockFunc generates a mocking method on mockClz class generate mockery (https://github.com/vektra/mockery) compatible mocking implementation from syntax based declarations
func SetImportSpecs ¶
func SetImportSpecs(f *ast.File, imports []*ast.ImportSpec)
SetImportSpecs sets ImportSpecs in f's Decls section using the passed ImportSpecs
func WriteImportDecls ¶
func WriteImportDecls(writer io.Writer, imports []gosyntax.ImportSpec)
Types ¶
type ReturnFieldBinding ¶ added in v0.1.9
type ReturnFieldBinding struct { FuncInvokeParamsExpr string MockCallExpr string Fields []ReturnFieldBindingSpec }
type ReturnFieldBindingSpec ¶ added in v0.1.9
Click to show internal directories.
Click to hide internal directories.