Documentation ¶
Index ¶
- func CamelCaseString(s string) string
- func FilterColumnTypeSize(columnType string) string
- func FormatSourceCode(input string) (output string)
- func GenGormTable(config DbConfig, option OutputOption, tableName string) (err error)
- func GenOrmDatabase(config DbConfig, option OutputOption) (err error)
- func MysqlTypeToGoType(mysqlType string) string
- func StringInSlice(input string, list []string) bool
- type Column
- type DbConfig
- type GormGenerator
- type MysqlDB
- type OrmTag
- type OutputOption
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelCaseString ¶
CamelCaseString convert string to camel case
Example:
CamelCaseString("foo_id")
Output: FooId
func FilterColumnTypeSize ¶
过滤columnType中的大小 比如bigint(21) unsigned => bigint unsigned
func FormatSourceCode ¶
func GenGormTable ¶
func GenGormTable(config DbConfig, option OutputOption, tableName string) (err error)
GenGormTable 生成单表
func GenOrmDatabase ¶
func GenOrmDatabase(config DbConfig, option OutputOption) (err error)
GenOrmDatabase 生成整个数据库
func MysqlTypeToGoType ¶
func StringInSlice ¶
Types ¶
type GormGenerator ¶
type GormGenerator struct {
// contains filtered or unexported fields
}
func NewGormGenerator ¶
func NewGormGenerator(c OutputOption) *GormGenerator
func (*GormGenerator) FormatTable ¶
func (p *GormGenerator) FormatTable(table *Table) string
type MysqlDB ¶
type MysqlDB struct { DbConfig // contains filtered or unexported fields }
func NewMysqlDB ¶
func (*MysqlDB) GetColumns ¶
GetColumns retrieves columns details from information_schema and fill in the Column struct
func (*MysqlDB) GetPkColumns ¶
GetPkColumns 获取主键
func (*MysqlDB) GetTableNames ¶
GetTableNames returns a slice of table names in the current database
type OutputOption ¶
func (OutputOption) GetOutputMode ¶
func (p OutputOption) GetOutputMode() io.WriteCloser
Click to show internal directories.
Click to hide internal directories.