mirror of
https://gitee.com/johng/gf.git
synced 2024-11-30 03:07:45 +08:00
修复gdb类型Result/Map转换问题
This commit is contained in:
parent
fb9f7ea3b2
commit
3ac7169cf7
@ -6,10 +6,6 @@
|
||||
|
||||
package gdb
|
||||
|
||||
import (
|
||||
"gitee.com/johng/gf/g/util/gconv"
|
||||
)
|
||||
|
||||
// 将结果集转换为List类型返回,便于json处理
|
||||
func (r Result) ToList() List {
|
||||
l := make(List, len(r))
|
||||
@ -24,7 +20,7 @@ func (r Result) ToStringMap(key string) map[string]Map {
|
||||
m := make(map[string]Map)
|
||||
for _, item := range r {
|
||||
if v, ok := item[key]; ok {
|
||||
m[gconv.String(v)] = item.ToMap()
|
||||
m[v.String()] = item.ToMap()
|
||||
}
|
||||
}
|
||||
return m
|
||||
@ -35,7 +31,7 @@ func (r Result) ToIntMap(key string) map[int]Map {
|
||||
m := make(map[int]Map)
|
||||
for _, item := range r {
|
||||
if v, ok := item[key]; ok {
|
||||
m[gconv.Int(v)] = item.ToMap()
|
||||
m[v.Int()] = item.ToMap()
|
||||
}
|
||||
}
|
||||
return m
|
||||
@ -46,7 +42,7 @@ func (r Result) ToUintMap(key string) map[uint]Map {
|
||||
m := make(map[uint]Map)
|
||||
for _, item := range r {
|
||||
if v, ok := item[key]; ok {
|
||||
m[gconv.Uint(v)] = item.ToMap()
|
||||
m[v.Uint()] = item.ToMap()
|
||||
}
|
||||
}
|
||||
return m
|
||||
@ -57,7 +53,7 @@ func (r Result) ToStringRecord(key string) map[string]Record {
|
||||
m := make(map[string]Record)
|
||||
for _, item := range r {
|
||||
if v, ok := item[key]; ok {
|
||||
m[gconv.String(v)] = item
|
||||
m[v.String()] = item
|
||||
}
|
||||
}
|
||||
return m
|
||||
@ -68,7 +64,7 @@ func (r Result) ToIntRecord(key string) map[int]Record {
|
||||
m := make(map[int]Record)
|
||||
for _, item := range r {
|
||||
if v, ok := item[key]; ok {
|
||||
m[gconv.Int(v)] = item
|
||||
m[v.Int()] = item
|
||||
}
|
||||
}
|
||||
return m
|
||||
@ -79,7 +75,7 @@ func (r Result) ToUintRecord(key string) map[uint]Record {
|
||||
m := make(map[uint]Record)
|
||||
for _, item := range r {
|
||||
if v, ok := item[key]; ok {
|
||||
m[gconv.Uint(v)] = item
|
||||
m[v.Uint()] = item
|
||||
}
|
||||
}
|
||||
return m
|
||||
|
Loading…
Reference in New Issue
Block a user