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) 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 ¶
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 ¶
func GetModelMethod(v interface{}, skip int) (method *DIYMethods, err error)
GetModelMethod get diy methods
func (*DIYMethods) LoadMethods ¶
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 ¶
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 ¶
func (*Method) DocComment ¶
DocComment return comment sql add "//" every line
func (*Method) GetBaseStructTmpl ¶
GetBaseStructTmpl return method bind info string
func (*Method) GetParamInTmpl ¶
GetParamInTmpl return param list
func (*Method) GetResultParamInTmpl ¶
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 ¶
IsBaseType judge whether the param type is basic type