Documentation ¶
Index ¶
- Constants
- Variables
- func Add() cli.Command
- func ConnectDB(cfg *mysql.Config) error
- func FolderName() string
- func GoModName() string
- func Mkdir(name string) error
- func MysqlConfig(c *cli.Context) *mysql.Config
- func New() cli.Command
- func ProjectPath() string
- func Quote(s string) string
- func ReBindata(dir string, suffix string)
- func StringInSlice(s string, slice []string) bool
- type Column
- type Table
- func (t Table) AutomaticCreateUpdateExpression(obj string) string
- func (t Table) AutomaticUpdateExpression(obj string) string
- func (t Table) AutomaticUpdateMapExpression() string
- func (t Table) CamelCaseName() string
- func (t Table) CamelCaseNameWithDBName() string
- func (t Table) ExecTemplate(mvc string, dir string)
- func (t Table) HasStateColumn() bool
- func (t Table) ImportLibrary(dir string) string
- func (t Table) Initials() string
- func (t Table) IsUserTable() bool
- func (t Table) LowerName() string
- func (t Table) MethodDelete() string
- func (t Table) MethodTake() string
- func (t Table) NamedSQL() string
- func (t Table) PasswordColumn() Column
- func (t Table) PrimaryKeyColumn() Column
- func (t Table) SQLColumns() string
- func (t Table) StateColumn() Column
- func (t Table) StdSQL() string
- func (t Table) SwitchCase() string
- func (t Table) UsernameColumn() Column
- type TemplateData
Constants ¶
View Source
const (
MVCDefaultDir = "mvc_default_dir"
)
Variables ¶
View Source
var ( DBAddrFlag = cli.StringFlag{Name: "addr", Value: "127.0.0.1:3306"} DBUserFlag = cli.StringFlag{Name: "user", Value: "root"} DBPasswdFlag = cli.StringFlag{Name: "passwd", Value: "123456"} DBNameFlag = cli.StringFlag{Name: "db", Value: "test", Destination: &DBName} DBTableFlag = cli.StringFlag{Name: "table"} DirFlag = cli.StringFlag{Name: "dir", Value: MVCDefaultDir} )
View Source
var ( AutoAssignFields []string AutoAssignCreateFields = []string{ "ctime", "Ctime", "created", "Created", "create_time", "created_time", "created_at", "create_at", "createdAt", "createAt", "addtime", "AddTime", } AutoAssignUpdateFields = []string{ "utime", "Utime", "updated", "Updated", "update_time", "updated_time", "updated_at", "update_at", "updatedAt", "updateAt", } AutoAssignDeleteFields = []string{ "dtime", "Dtime", "deleted", "Deleted", "delete_time", "deleted_time", "deletetime", "DeleteTime", "deleted_at", "delete_at", "deletedAt", "deleteAt", } StateFields = []string{ "state", "status", } UsernameFields = []string{ "user", "username", } PasswordFields = []string{ "passwd", "password", } )
View Source
var (
DBName string
)
Functions ¶
func FolderName ¶
func FolderName() string
func StringInSlice ¶
Types ¶
type Column ¶
type Column struct { ColumnName string `json:"column_name" db:"column_name"` DataType string `json:"data_type" db:"data_type"` ColumnType string `json:"column_type" db:"column_type"` ColumnComment string `json:"column_comment" db:"column_comment"` ColumnKey string `json:"column_key" db:"column_key"` ColumnDefault sql.NullString `json:"column_default" db:"column_default"` }
func (Column) CamelCaseName ¶
func (Column) IsPrimaryKey ¶
type Table ¶
func (Table) AutomaticCreateUpdateExpression ¶
func (Table) AutomaticUpdateExpression ¶
func (Table) AutomaticUpdateMapExpression ¶
func (Table) CamelCaseName ¶
func (Table) CamelCaseNameWithDBName ¶
func (Table) ExecTemplate ¶
func (Table) HasStateColumn ¶
func (Table) ImportLibrary ¶
func (Table) IsUserTable ¶
func (Table) MethodDelete ¶
func (Table) MethodTake ¶
func (Table) PasswordColumn ¶
func (Table) PrimaryKeyColumn ¶
func (Table) SQLColumns ¶
func (Table) StateColumn ¶
func (Table) SwitchCase ¶
func (Table) UsernameColumn ¶
type TemplateData ¶
type TemplateData struct { ProjectName string ProjectPath string MysqlConfig *mysql.Config DBName string Tables []Table }
func (TemplateData) HasUserTable ¶
func (t TemplateData) HasUserTable() bool
func (TemplateData) UserTable ¶
func (t TemplateData) UserTable() Table
Directories ¶
Path | Synopsis |
---|---|
Code generated by go-bindata.
|
Code generated by go-bindata. |
Code generated by go-bindata.
|
Code generated by go-bindata. |
Click to show internal directories.
Click to hide internal directories.