Signed-off-by: 商讯在线 <swhbox@foxmail.com>
This commit is contained in:
商讯在线 2014-02-11 21:42:14 +08:00
parent da96e0cc86
commit d0567a63b4
1 changed files with 2 additions and 14 deletions

View File

@ -486,8 +486,7 @@ func (engine *Engine) mapType(t reflect.Type) *Table {
var indexType int
var indexName string
var preKey string
for j, ln := 0, len(tags); j < ln; j++ {
key := tags[j]
for j, key := range tags {
k := strings.ToUpper(key)
switch {
case k == "<-":
@ -538,18 +537,7 @@ func (engine *Engine) mapType(t reflect.Type) *Table {
if preKey != "DEFAULT" {
col.Name = key[1 : len(key)-1]
}
} else if strings.Contains(k, "(") && (strings.HasSuffix(k, ")") || strings.HasSuffix(k, ",")) {
//[SWH|+]
if strings.HasSuffix(k, ",") {
j++
for j < ln {
k += tags[j]
if strings.HasSuffix(tags[j], ")") {
break
}
j++
}
}
} else if strings.Contains(k, "(") && strings.HasSuffix(k, ")") {
fs := strings.Split(k, "(")
if _, ok := sqlTypes[fs[0]]; !ok {
preKey = k