diff options
-rw-r--r-- | rddb/rddb.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/rddb/rddb.go b/rddb/rddb.go index 80cbb38..f1fe580 100644 --- a/rddb/rddb.go +++ b/rddb/rddb.go @@ -109,8 +109,10 @@ type ShowListEntry struct { highCart int } +type ShowList map[uint]ShowListEntry + type getShowListResult struct { - shows []ShowListEntry + shows ShowList err error } @@ -341,6 +343,7 @@ func (db *DB) getShowList(username string) (result getShowListResult) { } defer rows.Close() + result.shows = make(map[uint]ShowListEntry) for rows.Next() { var show ShowListEntry var macros, params string @@ -349,7 +352,7 @@ func (db *DB) getShowList(username string) (result getShowListResult) { return } show.log = showMacroRe.FindStringSubmatch(macros)[1] - result.shows = append(result.shows, show) + result.shows[show.ID] = show } result.err = rows.Err() return @@ -564,7 +567,7 @@ func (db *DBChan) GetMusicInfo(groupname string) (int, int, error) { return res.normLvl, res.trimLvl, nil } -func (db *DBChan) GetShowList(username string) ([]ShowListEntry, error) { +func (db *DBChan) GetShowList(username string) (ShowList, error) { resCh := make(chan getShowListResult) req := getShowListRequest{} req.username = username |