defines

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetName

func GetName(names []*ast.Ident) string

func ParseSQL

func ParseSQL(comment, dialect string) string

func ParseSelectorExprType

func ParseSelectorExprType(se *ast.SelectorExpr, ptr bool) *objs.Type

Types

type Func

type Func struct {
	// repoIntf *RepoInterface
	*Object
	Template Template
}

func NewFunc

func NewFunc(repo *RepoInterface) *Func

func NewFuncWithObject

func NewFuncWithObject(o *Object) *Func

func (*Func) AddDBUtilPackage

func (f *Func) AddDBUtilPackage() string

func (*Func) AddRunTimePackage

func (f *Func) AddRunTimePackage() string

func (*Func) AddSQLPackage

func (f *Func) AddSQLPackage() string

func (*Func) AddXTypePackage

func (f *Func) AddXTypePackage(fullPkgPath string) string

func (*Func) CreateError

func (f *Func) CreateError(format string, v ...interface{}) error

func (*Func) Format

func (f *Func) Format(format string, v ...interface{}) string

func (*Func) Parse

func (f *Func) Parse(method *ast.Field, dialect string) error

type Info

type Info struct {
	Parsed             bool
	Package            string
	PackageName        string
	OldRepositoriesMap map[string]bool // 从已存在的 interface.go 文件中读取的已经提供的 Repository 列表
	Dir                string
	Dialect            string
	FSet               *token.FileSet `json:"-"`
	Files              []*RepoFile
	// contains filtered or unexported fields
}

func NewInfo

func NewInfo(pkg string, dialect constants.DIALECT, logger logger.GpaLogger) *Info

func (*Info) CreateImplementFilePath

func (m *Info) CreateImplementFilePath(fileName string) string

func (*Info) CreateInterfaceFilePath

func (m *Info) CreateInterfaceFilePath(fileName string) string

func (*Info) CreateRepositoryDirIfNotExists

func (m *Info) CreateRepositoryDirIfNotExists() error

oldname: CheckDialectDir

func (*Info) FindRepoFiles

func (m *Info) FindRepoFiles() (err error)

func (*Info) GenerateImplementFilePath

func (m *Info) GenerateImplementFilePath(fileName string) string

oldname: CreateImplementFilePath

func (*Info) GenerateInterfaceFilePath

func (m *Info) GenerateInterfaceFilePath(fileName string) string

oldname: CreateInterfaceFilePath

func (*Info) IsProvidesChanged

func (m *Info) IsProvidesChanged() bool

func (*Info) TraverseFuncs

func (m *Info) TraverseFuncs(fn func(f *Func, intf *RepoInterface, rf *RepoFile) error) error

func (*Info) TraverseRepoFiles

func (m *Info) TraverseRepoFiles(fn func(rf *RepoFile) error) error

func (*Info) TraverseRepos

func (m *Info) TraverseRepos(fn func(intf *RepoInterface, rf *RepoFile) error) error

type Object

type Object struct {
	*objs.Object

	SQL string
	// contains filtered or unexported fields
}

func NewEmptyObject

func NewEmptyObject(repo *RepoInterface) *Object

func NewObject

func NewObject(repo *RepoInterface, obj *objs.Object) *Object

func (*Object) GetBeanType

func (o *Object) GetBeanType() (*xtype.XType, error)

func (*Object) GetRepoInterface

func (o *Object) GetRepoInterface() *RepoInterface

func (*Object) MakeObject

func (o *Object) MakeObject(obj *objs.Object) *Object

func (*Object) Parse

func (o *Object) Parse(field *ast.Field, expr ast.Expr, dialect string, level int) error

type RepoFile

type RepoFile struct {
	File *ast.File `json:"-"`
	// Parsed  bool
	Name              string
	Path              string
	Package           string
	Imports           map[string]string // key: 简写包名称  value: 包全称
	ImportsReverseMap map[string]string // key: 包全称      value: 简写包名称
	Repos             []*RepoInterface

	SQLPackage     string // database/sql
	RunTimePackage string // gitee.com/knowgo/gpa/rt
	DBUtilPackage  string // gitee.com/knowgo/gpa/rt/dbutil
	// contains filtered or unexported fields
}

func NewRepoFile

func NewRepoFile(info *Info, file *ast.File) *RepoFile

func (*RepoFile) AddDBUtilPackage

func (rf *RepoFile) AddDBUtilPackage() string

func (*RepoFile) AddRepo

func (rf *RepoFile) AddRepo(repo *RepoInterface)

func (*RepoFile) AddRuntimePackage

func (rf *RepoFile) AddRuntimePackage() string

func (*RepoFile) AddSQLPackage

func (rf *RepoFile) AddSQLPackage() string

func (*RepoFile) AddXTypePackage

func (rf *RepoFile) AddXTypePackage(pkgPath string) string

func (*RepoFile) FindImport

func (rf *RepoFile) FindImport(pkg string) string

func (*RepoFile) FindPackagePath

func (rf *RepoFile) FindPackagePath(pkg string) (string, error)

func (*RepoFile) Parse

func (rf *RepoFile) Parse(dialect string) error

type RepoInterface

type RepoInterface struct {
	Name           string
	Funcs          []*Func
	RunTimePackage string
	// contains filtered or unexported fields
}

func NewRepoInterface

func NewRepoInterface(name string, logger logger.GpaLogger) *RepoInterface

func (*RepoInterface) AddFunction

func (rf *RepoInterface) AddFunction(fn *Func)

func (*RepoInterface) Parse

func (rf *RepoInterface) Parse(body *ast.InterfaceType, dialect string) error

type Template

type Template string
const (
	INSERT Template = "insert"
	UPDATE Template = "update"
	DELETE Template = "delete"
	FIND   Template = "find"
	COUNT  Template = "count"
)

Jump to

Keyboard shortcuts

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