1
0
mirror of https://github.com/beego/bee.git synced 2025-07-05 18:20:18 +00:00

support migrate generate sql

This commit is contained in:
astaxie
2014-08-18 11:51:57 +08:00
parent 70886d4cfd
commit 67c1c05a45
5 changed files with 129 additions and 35 deletions

View File

@ -71,30 +71,6 @@ func getStruct(structname, fields string) (string, error) {
return structStr, nil
}
func camelString(s string) string {
data := make([]byte, 0, len(s))
j := false
k := false
num := len(s) - 1
for i := 0; i <= num; i++ {
d := s[i]
if k == false && d >= 'A' && d <= 'Z' {
k = true
}
if d >= 'a' && d <= 'z' && (j || k == false) {
d = d - 32
j = false
k = true
}
if k && d == '_' && num > i && s[i+1] >= 'a' && s[i+1] <= 'z' {
j = true
continue
}
data = append(data, d)
}
return string(data[:len(data)])
}
// fields support type
// http://beego.me/docs/mvc/model/models.md#mysql
func getType(ktype string) (kt, tag string) {