Documentation ¶
Index ¶
- type DIYMethods
- type InterfaceInfo
- type InterfacePath
- type InterfaceSet
- type Method
- type Param
- func (p *Param) Eq(q Param) bool
- func (p *Param) InMainPkg() bool
- func (p *Param) IsBaseType() bool
- func (p *Param) IsError() bool
- func (p *Param) IsGenM() bool
- func (p *Param) IsGenRowsAffected() bool
- func (p *Param) IsGenT() bool
- func (p *Param) IsInterface() bool
- func (p *Param) IsMap() bool
- func (p *Param) IsNull() bool
- func (p *Param) IsSQLResult() bool
- func (p *Param) IsSQLRow() bool
- func (p *Param) IsSQLRows() bool
- func (p *Param) IsTime() bool
- func (p *Param) SetName(name string)
- func (p *Param) TmplString() string
- func (p *Param) TypeName() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DIYMethods ¶ added in v0.3.9
type DIYMethods struct { BaseStructType string MethodName string Methods []*Method // contains filtered or unexported fields }
DIYMethods user Custom methods bind to db base struct
func GetModelMethod ¶ added in v0.3.14
func GetModelMethod(v interface{}) (method *DIYMethods, err error)
GetModelMethod get diy methods
func (*DIYMethods) LoadMethods ¶ added in v0.3.9
func (m *DIYMethods) LoadMethods() error
LoadMethods ast read file get diy method
type InterfaceInfo ¶
type InterfaceInfo struct { Name string Doc string Methods []*Method Package string ApplyStruct []string }
InterfaceInfo ...
func (*InterfaceInfo) MatchStruct ¶ added in v0.3.9
func (i *InterfaceInfo) MatchStruct(name string) bool
MatchStruct ...
type InterfacePath ¶
InterfacePath interface path
func GetInterfacePath ¶
func GetInterfacePath(v interface{}) (paths []*InterfacePath, err error)
GetInterfacePath get interface's directory path and all files it contains
type InterfaceSet ¶
type InterfaceSet struct { Interfaces []InterfaceInfo // contains filtered or unexported fields }
InterfaceSet ...
func (*InterfaceSet) ParseFile ¶
func (i *InterfaceSet) ParseFile(paths []*InterfacePath, structNames []string) error
ParseFile get interface's info from source file
type Method ¶
type Method struct { Receiver Param MethodName string Doc string Params []Param Result []Param Body string }
Method Apply to query struct and base struct custom method
func DefaultMethodTableName ¶ added in v0.3.18
func (*Method) DocComment ¶ added in v0.3.9
DocComment return comment sql add "//" every line
func (*Method) GetBaseStructTmpl ¶ added in v0.3.9
GetBaseStructTmpl return method bind info string
func (*Method) GetParamInTmpl ¶ added in v0.3.9
GetParamInTmpl return param list
func (*Method) GetResultParamInTmpl ¶ added in v0.3.9
GetResultParamInTmpl return result list
type Param ¶
type Param struct { PkgPath string // package's path: internal/model Package string // package's name: model Name string // param's name: user Type string // param's type: User IsArray bool // is array or not IsPointer bool // is pointer or not }
Param parameters in method
func (*Param) IsBaseType ¶ added in v0.3.9
IsBaseType judge whether the param type is basic type
func (*Param) IsGenRowsAffected ¶ added in v0.1.1
IsGenRowsAffected ...
func (*Param) TmplString ¶ added in v0.3.9
TmplString param to string in tmpl