feat(handlers): replace boltdb with sqlite in handlers
This commit is contained in:
parent
791848f75c
commit
085a3e4e10
14 changed files with 342 additions and 307 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
|
@ -164,3 +165,12 @@ func GetUserInfo(tokenStr string, tokenEncDec cryptoutil.ITokenEncDec) (map[stri
|
|||
|
||||
return claims, nil
|
||||
}
|
||||
|
||||
func GetUserId(ctx *gin.Context) (uint64, error) {
|
||||
userID, ok := ctx.MustGet(UserIDParam).(string)
|
||||
if !ok {
|
||||
return 0, errors.New("user id not found")
|
||||
}
|
||||
|
||||
return strconv.ParseUint(userID, 10, 64)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue