imake

package
v0.0.0-...-9d89862 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version string = "0.0.7"

Version generate tool version

Functions

func Flags

func Flags(set *pflag.FlagSet)

Flags generate tool flags

func GenerateStructInterface

func GenerateStructInterface(g *gen.Generator, decl *ast.GenDecl, typ *ast.TypeSpec, cm ast.CommentMap)

GenerateStructInterface generate struct interface

func GetIfaceName

func GetIfaceName(name string) string

func HasPrefix

func HasPrefix(val string, ct ...string) bool

func IsGenerateMethod

func IsGenerateMethod(name string) bool

IsGenerateMethod 是否生成结构体的方法

func IsGenerateStruct

func IsGenerateStruct(name string) bool

IsGenerateStruct 是否生成结构体

func ParsePackages

func ParsePackages(pkg *goparse.Package,
	IsGenerateStruct func(name string) bool,
	IsGenerateMethod func(name string) bool,
	dstPackage string,
) (data map[string]*StructInfo)

parse dst package. collecte structs infos

func RunCommand

func RunCommand(cmd *cobra.Command, args []string)

RunCommand run generate command

Types

type CompositeStructInfo

type CompositeStructInfo struct {
	Typ      string
	IsStruct bool
}

type StructField

type StructField struct {
	Names []string
	Type  string
}

func ToFileds

func ToFileds(fset *token.FileSet, in *ast.FieldList, changeType func(string) string) (out []*StructField)

func (*StructField) String

func (f *StructField) String() string

type StructInfo

type StructInfo struct {
	Typ        string
	Composites []*CompositeStructInfo
	Doc        string
	Comment    string
	Methods    []*StructMethod
	// contains filtered or unexported fields
}

type StructMethod

type StructMethod struct {
	Doc     string
	Comment string
	Name    string
	Params  []*StructField
	Results []*StructField
	// contains filtered or unexported fields
}

func (*StructMethod) Args

func (m *StructMethod) Args() string

func (*StructMethod) Args2

func (m *StructMethod) Args2() string

func (*StructMethod) Rets

func (m *StructMethod) Rets() string

func (*StructMethod) String

func (m *StructMethod) String() string

Jump to

Keyboard shortcuts

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