Sort GP list by amount
This commit is contained in:
parent
eb10fde8f7
commit
52f4898c2b
3 changed files with 9 additions and 9 deletions
|
@ -13,21 +13,21 @@ var gpSelectChat *sql.Stmt
|
|||
|
||||
var gpSet *sql.Stmt
|
||||
|
||||
func sqlGetAllGP(chatid int64) (gaypoints map[int64]int64) {
|
||||
func sqlGetAllGP(chatid int64) (gaypoints []gaypointShortDetails) {
|
||||
rows, err := gpSelectChat.Query(chatid)
|
||||
if err != nil {
|
||||
log.Panicf("Failed to query gaypoints: %v\n", err)
|
||||
}
|
||||
|
||||
gaypoints = make(map[int64]int64)
|
||||
var c int64
|
||||
var b int64
|
||||
for rows.Next() {
|
||||
switch err := rows.Scan(&c, &b); err {
|
||||
case sql.ErrNoRows:
|
||||
gaypoints[c] = -1
|
||||
case nil:
|
||||
gaypoints[c] = b
|
||||
gaypoints = append(gaypoints, gaypointShortDetails{
|
||||
userID: c,
|
||||
gaypoints: b,
|
||||
})
|
||||
default:
|
||||
log.Panicf("Failed to query gaypoints: %v\n", err)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue