Handle []string for Select

This commit is contained in:
Jinzhu 2015-05-11 15:17:35 +08:00
parent edecbde19d
commit 5af077cd2d
1 changed files with 2 additions and 0 deletions

View File

@ -368,6 +368,8 @@ func (scope *Scope) SelectAttrs() []string {
for _, value := range scope.Search.selects { for _, value := range scope.Search.selects {
if str, ok := value.(string); ok { if str, ok := value.(string); ok {
attrs = append(attrs, str) attrs = append(attrs, str)
} else if strs, ok := value.([]string); ok {
attrs = append(attrs, strs...)
} else if strs, ok := value.([]interface{}); ok { } else if strs, ok := value.([]interface{}); ok {
for _, str := range strs { for _, str := range strs {
attrs = append(attrs, fmt.Sprintf("%v", str)) attrs = append(attrs, fmt.Sprintf("%v", str))