Documentation
¶
Index ¶
- Constants
- Variables
- type AutoTime
- type Column
- func (c *Column) CheckDelField() string
- func (c *Column) FilterComment() string
- func (c *Column) GetDefCol() string
- func (c *Column) GetGoType(nullable bool) string
- func (c *Column) IsCurrentTimeStamp() bool
- func (c *Column) IsOnUpdate() bool
- func (c *Column) IsPri() bool
- func (c *Column) IsTime(goType string) bool
- type Columns
- type ColumnsRepo
- type DBColumnsInter
- type DaoDomainFileOption
- type DbConfig
- type DomainFile
- type EntityDomainFileOption
- type InjectInfo
- type Provide
- type ProvideRepoFunc
- type Provides
- type RepoDomainFileOption
- type ShareInfo
- type StubsColumnsRepo
Constants ¶
View Source
const (
DomainFileExt = ".go"
)
Variables ¶
View Source
var (
Cols = []Column{
{
ColumnName: "user_name",
DataType: "varchar",
IsNullAble: yesNull,
ColumnComment: "user name",
},
{
ColumnName: "id",
ColumnKey: pri,
DataType: "int",
IsNullAble: noNull,
},
{
ColumnName: "update_time",
DataType: "timestamp",
IsNullAble: noNull,
Extra: upCurrentTimestamp,
},
}
)
View Source
var ProvideFuncTemplate = `` /* 128-byte string literal not displayed */
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct {
ColumnName string `gorm:"column:COLUMN_NAME"`
ColumnKey string `gorm:"column:COLUMN_KEY"`
DataType string `gorm:"column:DATA_TYPE"`
IsNullAble string `gorm:"column:IS_NULLABLE"`
ColumnDefault string `gorm:"column:COLUMN_DEFAULT"`
CharacterMaximumLength string `gorm:"column:CHARACTER_MAXIMUM_LENGTH"`
ColumnComment string `gorm:"column:COLUMN_COMMENT"`
Extra string `gorm:"column:EXTRA"`
}
func (*Column) CheckDelField ¶
func (*Column) FilterComment ¶
filterComment filter and escaping speckial string.
func (*Column) IsCurrentTimeStamp ¶
func (*Column) IsOnUpdate ¶
type ColumnsRepo ¶
func NewDBColumnsInter ¶
func NewDBColumnsInter(logger log.Logger) ColumnsRepo
type DBColumnsInter ¶
type DBColumnsInter struct {
// contains filtered or unexported fields
}
func (*DBColumnsInter) SelectColumns ¶
func (dc *DBColumnsInter) SelectColumns(dbConf *DbConfig) (Columns, error)
SelectColumns Select column details.
type DaoDomainFileOption ¶
type DaoDomainFileOption func(*daoDomainFile)
func WithDaoDomainFileLogger ¶
func WithDaoDomainFileLogger(logger log.Logger) DaoDomainFileOption
func WithDaoDomainFileTpl ¶
func WithDaoDomainFileTpl(tpl templates.Tpl) DaoDomainFileOption
type DbConfig ¶
type DbConfig struct {
Host string
Port int
User string
Password string
Database string
Table string
}
func NewDbConfig ¶
func NewDbConfig() *DbConfig
type DomainFile ¶
type DomainFile interface {
// if true not need this domain file
Disabled() bool
BindInput(*viper.Viper) error
// parse columns information for domain file object
ParseCloumns(Columns, *ShareInfo)
// applies a parsed template to the domain file object
// return Parsed content
Execute() string
// save the domain file content path
GetSavePath() string
GetName() string
GetInjectInfo() *InjectInfo
}
func NewDaoDomainFile ¶
func NewDaoDomainFile(options ...DaoDomainFileOption) DomainFile
func NewEntityDomainFile ¶
func NewEntityDomainFile(options ...EntityDomainFileOption) DomainFile
func NewRepoDomainFile ¶
func NewRepoDomainFile(options ...RepoDomainFileOption) DomainFile
type EntityDomainFileOption ¶
type EntityDomainFileOption func(*entityDomainFile)
func WithEntityDomainFileLogger ¶
func WithEntityDomainFileLogger(logger log.Logger) EntityDomainFileOption
func WithEntityDomainFileTpl ¶
func WithEntityDomainFileTpl(tpl templates.Tpl) EntityDomainFileOption
type InjectInfo ¶
type InjectInfo struct {
Fields pkg.Fields
Imports pkg.Imports
InfraSetArgs []string
ProvideRepoFuns []ProvideRepoFunc
}
func NewInjectInfo ¶
func NewInjectInfo() *InjectInfo
type ProvideRepoFunc ¶ added in v0.1.2
type ProvideRepoFunc struct {
FuncName *dst.Ident
ParamName *dst.Ident
ParamType *dst.Ident
Result *dst.Ident
BodyFunc *dst.Ident
BodyFuncArg *dst.Ident
}
func NewProvideRepoFunc ¶ added in v0.1.2
func NewProvideRepoFunc(entityName, path string) ProvideRepoFunc
type RepoDomainFileOption ¶
type RepoDomainFileOption func(*repoDomainFile)
func WithRepoDomainFileLogger ¶
func WithRepoDomainFileLogger(logger log.Logger) RepoDomainFileOption
func WithRepoDomainFileTpl ¶
func WithRepoDomainFileTpl(tpl templates.Tpl) RepoDomainFileOption
type ShareInfo ¶
type ShareInfo struct {
CamelStruct string
}
Share information for all domain files avoid import cycle not allowed.
func NewShareInfo ¶
func NewShareInfo() *ShareInfo
type StubsColumnsRepo ¶
type StubsColumnsRepo struct{}
func (StubsColumnsRepo) SelectColumns ¶
func (scr StubsColumnsRepo) SelectColumns(dbConf *DbConfig) (Columns, error)
Click to show internal directories.
Click to hide internal directories.