add comment
This commit is contained in:
parent
b75453cee9
commit
4b015522fe
@ -25,6 +25,7 @@ func ScanToStruct(rows *sql.Rows, ss interface{}) (ok bool, err error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// ScanToStructAll -
|
||||
func ScanToStructAll(rows *sql.Rows, ss interface{}) error {
|
||||
sliceVal := reflect.Indirect(reflect.ValueOf(ss))
|
||||
if sliceVal.Kind() != reflect.Slice {
|
||||
@ -53,6 +54,7 @@ func ScanToStructAll(rows *sql.Rows, ss interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ResultToMap -
|
||||
func ResultToMap(r *sql.Rows) ([]map[string]interface{}, error) {
|
||||
result := make([]map[string]interface{}, 0)
|
||||
cols, err := r.Columns()
|
||||
@ -82,6 +84,7 @@ func ResultToMap(r *sql.Rows) ([]map[string]interface{}, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// MapToStruct -
|
||||
func MapToStruct(data map[string]interface{}, out interface{}) error {
|
||||
ss := reflect.ValueOf(out).Elem()
|
||||
for i := 0; i < ss.NumField(); i++ {
|
||||
|
Loading…
Reference in New Issue
Block a user