mirror of
https://github.com/beego/bee.git
synced 2024-11-22 20:20:55 +00:00
Merge pull request #103 from leitwolf/master
add tableName to model file
This commit is contained in:
commit
926ef73108
@ -761,6 +761,7 @@ func writeModelFiles(tables []*Table, mPath string, selectedTables map[string]bo
|
|||||||
}
|
}
|
||||||
fileStr := strings.Replace(template, "{{modelStruct}}", tb.String(), 1)
|
fileStr := strings.Replace(template, "{{modelStruct}}", tb.String(), 1)
|
||||||
fileStr = strings.Replace(fileStr, "{{modelName}}", camelCase(tb.Name), -1)
|
fileStr = strings.Replace(fileStr, "{{modelName}}", camelCase(tb.Name), -1)
|
||||||
|
fileStr = strings.Replace(fileStr, "{{tableName}}", tb.Name, -1)
|
||||||
// if table contains time field, import time.Time package
|
// if table contains time field, import time.Time package
|
||||||
timePkg := ""
|
timePkg := ""
|
||||||
importTimePkg := ""
|
importTimePkg := ""
|
||||||
@ -1003,6 +1004,10 @@ import (
|
|||||||
|
|
||||||
{{modelStruct}}
|
{{modelStruct}}
|
||||||
|
|
||||||
|
func (t *{{modelName}}) TableName() string {
|
||||||
|
return "{{tableName}}"
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
orm.RegisterModel(new({{modelName}}))
|
orm.RegisterModel(new({{modelName}}))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user