optimize table index

This commit is contained in:
MaysWind
2020-12-13 19:12:00 +08:00
parent c968aabbc1
commit 879051f02b
7 changed files with 34 additions and 12 deletions
+5 -1
View File
@@ -1,6 +1,8 @@
package api
import (
"sort"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
@@ -30,7 +32,7 @@ func (a *TokensApi) TokenListHandler(c *core.Context) (interface{}, *errs.Error)
return nil, errs.ErrOperationFailed
}
tokenResps := make([]*models.TokenInfoResponse, len(tokens))
tokenResps := make(models.TokenInfoResponseSlice, len(tokens))
claims := c.GetTokenClaims()
for i := 0; i < len(tokens); i++ {
@@ -50,6 +52,8 @@ func (a *TokensApi) TokenListHandler(c *core.Context) (interface{}, *errs.Error)
tokenResps[i] = tokenResp
}
sort.Sort(tokenResps)
return tokenResps, nil
}