Futher clarified error messaging for invalid `plucks'.

This commit is contained in:
Jay Taylor 2015-03-17 11:22:10 -07:00
parent 49bb1e19c2
commit 8c265d816a

View File

@ -3,7 +3,6 @@ package gorm
import (
"database/sql"
"database/sql/driver"
"errors"
"fmt"
"reflect"
"regexp"
@ -360,7 +359,7 @@ func (scope *Scope) pluck(column string, value interface{}) *Scope {
dest := reflect.Indirect(reflect.ValueOf(value))
scope.Search.Select(column)
if dest.Kind() != reflect.Slice {
scope.Err(errors.New("results should be a slice"))
scope.Err(fmt.Errorf("results should be a slice, not %s", dest.Kind()))
return scope
}