rename ScanStruct to ScanStructByIndex and ScanStruct2 to ScanStructByName

This commit is contained in:
Lunny Xiao 2014-04-21 15:13:32 +08:00
parent ea82aa0fbf
commit 4bcb0fbd6a
1 changed files with 2 additions and 2 deletions

4
db.go
View File

@ -252,7 +252,7 @@ type Rows struct {
}
// scan data to a struct's pointer according field index
func (rs *Rows) ScanStruct(dest ...interface{}) error {
func (rs *Rows) ScanStructByIndex(dest ...interface{}) error {
if len(dest) == 0 {
return errors.New("at least one struct")
}
@ -319,7 +319,7 @@ func fieldByName(v reflect.Value, name string) reflect.Value {
}
// scan data to a struct's pointer according field name
func (rs *Rows) ScanStruct2(dest interface{}) error {
func (rs *Rows) ScanStructByName(dest interface{}) error {
vv := reflect.ValueOf(dest)
if vv.Kind() != reflect.Ptr || vv.Elem().Kind() != reflect.Struct {
return errors.New("dest should be a struct's pointer")