task

package
v0.0.0-...-7b6962b Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskGenerate taskType = iota
	TaskClear
)

Variables

This section is empty.

Functions

func GenFileCode

func GenFileCode(pkg *PkgInfo) (string, bool)

func RunTask

func RunTask(task taskType, dir string)

Types

type PkgInfo

type PkgInfo struct {
	Name  string
	Pkg   string
	Types map[string]*Type
}

func NewPkgInfo

func NewPkgInfo(pkg string) *PkgInfo

func ScanPkgInfo

func ScanPkgInfo(dirPkg string, filePaths []string) (*PkgInfo, error)

func (*PkgInfo) FindOrInitType

func (pkg *PkgInfo) FindOrInitType(typeName string) *Type

func (*PkgInfo) SortedTypes

func (pkg *PkgInfo) SortedTypes() []*Type

type Property

type Property struct {
	Name         string
	Getter       string
	Setter       string
	Tag          string
	Type         ast.Expr
	ExistGetters map[string]bool
	ExistSetters map[string]bool
}

func NewProperty

func NewProperty(name string) *Property

func (*Property) AddExistGetter

func (typ *Property) AddExistGetter(name string)

func (*Property) AddExistSetter

func (typ *Property) AddExistSetter(name string)

type Type

type Type struct {
	Name           string
	RecvName       string
	PropertyNames  []string // 属性名列表,按类型定义字段顺序
	PropertyMap    map[string]*Property
	ExistRecvNames map[string]bool
}

func NewType

func NewType(name string) *Type

func (*Type) AddExistRecvName

func (typ *Type) AddExistRecvName(name string)

func (*Type) FindOrInitProperty

func (typ *Type) FindOrInitProperty(propName string) *Property

func (*Type) Properties

func (typ *Type) Properties() []*Property

Jump to

Keyboard shortcuts

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