dimeta

package
v1.0.1-rel-02 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: AFL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InjectDiDto

func InjectDiDto(s *DiDto)

func InjectDiInject

func InjectDiInject(s *DiInject)

func InjectFileInfoDto

func InjectFileInfoDto(s *FileInfoDto)

func InjectStructInfo

func InjectStructInfo(s *StructInfo)

func LoadDiDto

func LoadDiDto() baseiface.ISingleton

func LoadDiInject

func LoadDiInject() baseiface.ISingleton

func LoadFileInfoDto

func LoadFileInfoDto() baseiface.ISingleton

func LoadStructInfo

func LoadStructInfo() baseiface.ISingleton

Types

type DiDto

type DiDto struct {
	basedto.BaseEntity
	//包名
	FullPkg string `json:"fullPkg"`
	//NEW exist
	ExistNewFunc bool   `json:"ExistNewFunc"`
	NewFuncName  string `json:"NewFuncName"`

	//in
	PkgName    string `json:"pkg_name"`
	StructName string `json:"struct_name"`
	PathFile   string `json:"pathFile"`
	//output
	OutPath string `json:"out_path"`
	OutFile string `json:"out_file"`

	ImportedLibs []string             `json:"importedLibs,omitempty"`
	DiInjects    map[string]*DiInject `json:"diInjects,omitempty"`
	//可重新生成!
	ForceBuild bool `json:"force_build"`
}

func FindBeanDiDto

func FindBeanDiDto() *DiDto

FindBeanDiDto

func NewDiDto

func NewDiDto() *DiDto

func (*DiDto) FindImportLib

func (this *DiDto) FindImportLib(inject *DiInject)

func (*DiDto) ToInjectCode

func (this *DiDto) ToInjectCode() string

func (*DiDto) ToInjectImportLib

func (this *DiDto) ToInjectImportLib() string

type DiInject

type DiInject struct {
	basedto.BaseEntity

	InjectMod int `json:"injectMod"`
	//auto new bind
	Tag        string `json:"tag"`
	InjectCode string `json:"injectCode"`

	GoType    string `json:"goType"`
	ImportLib string `json:"importLib"`

	MemberName string `json:"memberName"` //multi
	MemberType string `json:"memberType"` //MultiEntity
	PkgName    string `json:"pkgName"`    //multi
}

di inject member

func FindBeanDiInject

func FindBeanDiInject() *DiInject

FindBeanDiInject

func NewDiInject

func NewDiInject() *DiInject

func (*DiInject) FilterInject

func (this *DiInject) FilterInject() bool

func (*DiInject) IsRootBaseEntity

func (this *DiInject) IsRootBaseEntity() bool

func (*DiInject) IsStruct

func (this *DiInject) IsStruct() bool

func (*DiInject) ParseTag

func (di *DiInject) ParseTag(field *ast.Field)

func (*DiInject) SetInjectMod

func (this *DiInject) SetInjectMod(isBaseEntity bool)

func (*DiInject) Tag2InjectMod

func (this *DiInject) Tag2InjectMod()

func (*DiInject) ToInjectCode

func (this *DiInject) ToInjectCode() string

type DiParseFields

type DiParseFields struct {
}

func NewParseFields

func NewParseFields() *DiParseFields

func (*DiParseFields) Parse

func (this *DiParseFields) Parse(field *ast.Field) *DiInject

func (*DiParseFields) ParseArrayType

func (this *DiParseFields) ParseArrayType(field *ast.Field, di *DiInject) bool

func (*DiParseFields) ParseIdent

func (this *DiParseFields) ParseIdent(field *ast.Field, di *DiInject) bool

func (*DiParseFields) ParseMapType

func (this *DiParseFields) ParseMapType(field *ast.Field, di *DiInject) bool

func (*DiParseFields) ParseName

func (this *DiParseFields) ParseName(field *ast.Field, di *DiInject) bool

func (*DiParseFields) ParseNoName

func (this *DiParseFields) ParseNoName(field *ast.Field, di *DiInject)

func (*DiParseFields) ParseSelectorExpr

func (this *DiParseFields) ParseSelectorExpr(field *ast.Field, di *DiInject) bool

func (*DiParseFields) ParseStarExpr

func (this *DiParseFields) ParseStarExpr(field *ast.Field, di *DiInject) bool

parse struct

type FileInfoDto

type FileInfoDto struct {
	basedto.BaseEntity

	PathFile    string `json:"path_file,omitempty"`
	FileContent string `json:"content,omitempty"`

	StructInfoMap map[string]*StructInfo `json:"struct_info_map,omitempty"`
	StructInfos   []*StructInfo
	FuncDefines   []*FuncDefine `json:"func_defines"`
	ImportedLibs  []string      `json:"importedLibs,omitempty"`

	Node *ast.File `json:"-"`
}

func FindBeanFileInfoDto

func FindBeanFileInfoDto() *FileInfoDto

FindBeanFileInfoDto

func NewFileInfoDto

func NewFileInfoDto() *FileInfoDto

func (*FileInfoDto) FindOf

func (this *FileInfoDto) FindOf(Struname string) *StructInfo

func (*FileInfoDto) ParseNewFunc

func (this *FileInfoDto) ParseNewFunc(Stru *StructInfo)

type FuncDefine

type FuncDefine struct {
	StruName      string
	Name          string
	Params        []*ast.Field `json:"-"`
	Results       []*ast.Field `json:"-"`
	ParamsCount   int
	ResultType    string
	ParamNameType string
}

func NewFuncDefine

func NewFuncDefine(name string) *FuncDefine

type StructInfo

type StructInfo struct {
	basedto.BaseEntity

	IsBaseEntiyStruct bool `json:"isBaseEntiyStruct"`
	*DiDto

	MethodNames []string      `json:"methodNames,omitempty"`
	FuncDefines []*FuncDefine `json:"func_defines"`

	Fields []string `json:"fields"`
}

func FindBeanStructInfo

func FindBeanStructInfo() *StructInfo

FindBeanStructInfo

func NewStructInfo

func NewStructInfo() *StructInfo

func (*StructInfo) AddField

func (s *StructInfo) AddField(fieldName string)

func (*StructInfo) AddMethodName

func (s *StructInfo) AddMethodName(methodName string)

func (*StructInfo) CheckBaseEntity

func (this *StructInfo) CheckBaseEntity() bool

func (*StructInfo) NewFuncNameDefault

func (this *StructInfo) NewFuncNameDefault() string

func (*StructInfo) ParsePkgName

func (s *StructInfo) ParsePkgName(rootdir, basepkg string)

Jump to

Keyboard shortcuts

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