result to map
This commit is contained in:
parent
cde5fe7366
commit
c362b6bc33
10
db.go
10
db.go
@ -697,3 +697,13 @@ func FormatForSQL(datatype string, value interface{}) string {
|
|||||||
}
|
}
|
||||||
return fmt.Sprint(strval)
|
return fmt.Sprint(strval)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build a map based on id from a query result
|
||||||
|
func (db *Db) BuildIdMap(idxkey string, rows Rows) (map[int64]AssRow, error) {
|
||||||
|
ht := make(map[int64]AssRow)
|
||||||
|
for _, row := range rows {
|
||||||
|
id := row[idxkey].(int64)
|
||||||
|
ht[id] = row
|
||||||
|
}
|
||||||
|
return ht, nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user