inner

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Interfacer = &cobra.Command{
		Use:   "Interfacer",
		Short: "Implement a method of the interface anywhere",
		Run:   implement,
	}

	ProjectDir    string
	ProjectModule string

	MethodName string // to be used when go:generate

)

Functions

func FindModuleRoot

func FindModuleRoot(dir string) (roots string)

func GetInterface

func GetInterface(modulePath string, moduleName string, methodName string) (interfaceFullName string, newMethod string, returnDefaultValues string, err error)

func GetModuleInfo

func GetModuleInfo(modulePath string) (string, string, error)

func GetModulePath

func GetModulePath() string

func HandlePromptError

func HandlePromptError(err error) bool

HandlePromptError the return value indicates whether the for loop needs to be executed

func InteractiveRun

func InteractiveRun()

InteractiveRun Tips: Before running, you should stash all changes for avoiding the wrong generation code 1. Get module info 2. Scan the module 3. Choose the interface 4. Add a new method 5. Add default return values 6. Choose the struct file or some struct can be ignored choose the other interface

func IsInterruptError

func IsInterruptError(err error) bool

func IsValidError

func IsValidError(err error) bool

Types

type Config

type Config struct {
	WritePaths          []string    `yaml:"write_paths,flow"`
	ExcludeDirs         []string    `yaml:"exclude_dirs,flow"`
	ProjectDir          string      `yaml:"project_dir"`
	ProjectModule       string      `yaml:"project_module"`
	InterfaceFullName   string      `yaml:"interface_full_name"`
	NewMethod           string      `yaml:"new_method"`
	ReturnDefaultValues string      `yaml:"return_default_values"`
	IgnoreStructs       []string    `yaml:"ignore_structs,flow"`
	EnableRecord        bool        `yaml:"enable_record"`
	EnableDebug         bool        `yaml:"enable_debug"`
	SubModules          []SubModule `yaml:"sub_modules,flow"`
}

type SubModule

type SubModule struct {
	ProjectDir          string   `yaml:"project_dir"`
	ProjectModule       string   `yaml:"project_module"`
	InterfaceFullName   string   `yaml:"interface_full_name"`
	Method              string   `yaml:"method"`
	ReturnDefaultValues string   `yaml:"return_default_values"`
	ExcludeDirs         []string `yaml:"exclude_dirs,flow"`
}

type ValidError

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

func NewValidErrorFromError

func NewValidErrorFromError(err error) *ValidError

func NewValidErrorFromString

func NewValidErrorFromString(msg string) *ValidError

Jump to

Keyboard shortcuts

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