mirror of https://github.com/go-gorm/gorm.git
Handle []string for Select
This commit is contained in:
parent
edecbde19d
commit
5af077cd2d
2
scope.go
2
scope.go
|
@ -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))
|
||||||
|
|
Loading…
Reference in New Issue