Documentation ¶
Overview ¶
参考 https://yq.aliyun.com/articles/178898?utm_content=m_29337
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Db *sql.DB = nil
Functions ¶
Types ¶
type Options ¶
type Options struct { MySqlUrl string //数据库地址 DSN (Data Source Name) :[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...¶mN=valueN] IfOneFile bool //多个表是否放在同一文件 true=同一文件 默认false FileName string //文件名 当IfOneFile=true时有效 默认Models.go PackageName string //自定义项目package名称 默认Models SavePath string //保存文件夹 默认./Models IfToHump bool //是否转换驼峰 true=是 默认false IfJsonTag bool //是否包含json tag true=是 默认false IfDbTag bool //是否包含db tag true=是 默认false IfPluralToSingular bool //是否复数转单数 true=是 默认false IfCapitalizeFirstLetter bool //是否首字母转换大写 true=是 默认false NeedCreateAtTables string //需要tag保留createAt的表, 多个逗号隔开 NeedUpdateAtTables string //需要tag保留updateAt的表, 多个逗号隔开 }
type TableToFile ¶
type TableToFile struct {
// contains filtered or unexported fields
}
type TableToStruct ¶
type TableToStruct struct { MySqlUrl string IfOneFile bool FileName string PackageName string SavePath string IfToHump bool IfJsonTag bool IfDbTag bool IfPluralToSingular bool IfCapitalizeFirstLetter bool NeedCreateAtTables []string NeedUpdateAtTables []string // contains filtered or unexported fields }
func CreateTableToStruct ¶
func CreateTableToStruct(options *Options) *TableToStruct
func (*TableToStruct) PrintDBColumns ¶
func (t2s *TableToStruct) PrintDBColumns(dbName string) error
打印数据库每个表的字段名称
func (*TableToStruct) Run ¶
func (t2s *TableToStruct) Run() error
Click to show internal directories.
Click to hide internal directories.