pkg

package
v0.0.0-...-5ed7541 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RenderFuncName                = "Render"
	RenderFileFuncName            = "RenderFile"
	RenderInterfaceFuncName       = "RenderInterface"
	RenderInterfaceMethodFuncName = "RenderInterfaceMethod"
)

Variables

This section is empty.

Functions

func Generate

func Generate(input *Input) error

func ParseDir

func ParseDir(path string, filterFiles func(fs.FileInfo) bool) ([]*pkgTypes.GoFile, error)

ParseFiles parses files at the same time

func ParseSingleFile

func ParseSingleFile(path string) (*pkgTypes.GoFile, error)

ParseSingleFile parses a single file at the same time

func ParseSource

func ParseSource(source string, filepath string) (*pkgTypes.GoFile, error)

func Render

func Render(
	pluginPath string,
	outputPath string,
	nameFilters []string,
	files []*types.GoFile,
) error

Types

type Input

type Input struct {
	DirectoryPath string `validate:"required"`
	PluginPath    string `validate:"required"`
	OutputPath    string `validate:"required"`

	NameFilters []string
}

Input is the input for the generate function

type PackImporter

type PackImporter struct {
	Fset *token.FileSet
}

func (*PackImporter) Import

func (this *PackImporter) Import(path string) (*types.Package, error)

type RenderFileFunc

type RenderFileFunc func(
	f *types.GoFile,
	jenFile *jen.File,
) error

Will be invoked for each file parsed

type RenderFunc

type RenderFunc func(
	files []*types.GoFile,
	file *jen.File,
) error

Will be invoked only once per generation

type RenderInterfaceFunc

type RenderInterfaceFunc func(
	ifc *types.GoInterface,
	file *jen.File,
) error

Will be invoked for each interface parsed in each file

type RenderInterfaceMethodFunc

type RenderInterfaceMethodFunc func(
	ifc *types.GoInterface,
	method *types.GoMethod,
	file *jen.File,
) error

Will be invoked for each method parsed in each interface in each file

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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