mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-22 04:56:49 +08:00
优化error返回
This commit is contained in:
@@ -393,7 +393,7 @@ func (slf *DataSetList) rowData2interface(rowIdx int, m map[string][]interface{}
|
|||||||
typ := t.Elem()
|
typ := t.Elem()
|
||||||
|
|
||||||
if !val.IsValid() {
|
if !val.IsValid() {
|
||||||
return errors.New("数据类型不正确")
|
return errors.New("Incorrect data type!")
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < val.NumField(); i++ {
|
for i := 0; i < val.NumField(); i++ {
|
||||||
@@ -409,7 +409,7 @@ func (slf *DataSetList) rowData2interface(rowIdx int, m map[string][]interface{}
|
|||||||
columnData, ok := m[vtag]
|
columnData, ok := m[vtag]
|
||||||
if ok == false {
|
if ok == false {
|
||||||
if !slf.blur {
|
if !slf.blur {
|
||||||
return fmt.Errorf("Cannot find filed name %s", vtag)
|
return fmt.Errorf("Cannot find filed name %s!", vtag)
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -419,12 +419,12 @@ func (slf *DataSetList) rowData2interface(rowIdx int, m map[string][]interface{}
|
|||||||
meta := columnData[rowIdx].(*sql.NullString)
|
meta := columnData[rowIdx].(*sql.NullString)
|
||||||
if !ok {
|
if !ok {
|
||||||
if !slf.blur {
|
if !slf.blur {
|
||||||
return fmt.Errorf("没有在结果集中找到对应的字段 %s", tag)
|
return fmt.Errorf("No corresponding field was found in the result set %s!", tag)
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !value.CanSet() {
|
if !value.CanSet() {
|
||||||
return errors.New("结构体字段没有读写权限")
|
return errors.New("Struct fields do not have read or write permissions!")
|
||||||
}
|
}
|
||||||
|
|
||||||
if meta.Valid == false {
|
if meta.Valid == false {
|
||||||
@@ -463,7 +463,7 @@ func (slf *DataSetList) rowData2interface(rowIdx int, m map[string][]interface{}
|
|||||||
}
|
}
|
||||||
value.SetBool(b)
|
value.SetBool(b)
|
||||||
default:
|
default:
|
||||||
return errors.New("数据库映射存在不识别的数据类型")
|
return errors.New("The database map has unrecognized data types!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user