package
1.0.0-dev1
Repository: https://github.com/ghostbb-io/g-api.git
Documentation: pkg.go.dev

# README

ginx

包裝gin常用函數

GetToken(c *gin.Context) string

Get jwt token from header (Authorization: Bearer xxx)

ParseJSON(c *gin.Context, obj interface{}) error

Parse body json data to struct

ParseParamID(c *gin.Context, key string) uint64

Param returns the value of the URL param

ParseParam(c *gin.Context, key string) string

Param returns the value of the URL param

ParseQuery(c *gin.Context, obj interface{}) error

Parse query parameter to struct

ParseForm(c *gin.Context, obj interface{}) error

Parse body form data to struct

SetUserID(c *gin.Context, userID uint)

將UserID寫入上下文

GetUserID(c *gin.Context) uint

獲取UserID

SetUserUUID(c *gin.Context, uuid uuid.UUID)

將User UUID寫入上下文

GetUserUUID(c *gin.Context) uuid.UUID

獲取User UUID

SetUserName(c *gin.Context, username string)

將user name寫入上下文

GetUserName(c *gin.Context) string

獲取user name

SetRole(c *gin.Context, roles []string)

將role寫入上下文

GetRole(c *gin.Context) []string

獲取role

# Functions

No description provided by the author
No description provided by the author
GetRole 獲取role.
GetToken Get jwt token from header (Authorization: Bearer xxx).
GetUserID 獲取UserID.
GetUserName 獲取user name.
GetUserUUID 獲取User UUID.
ParseForm Parse body form data to struct.
ParseJSON Parse body json data to struct.
ParseParam Param returns the value of the URL param.
ParseParamID Param returns the value of the URL param.
ParseQuery Parse query parameter to struct.
No description provided by the author
SetRole 將role寫入上下文.
SetUserID 將UserID寫入上下文.
SetUserName 將user name寫入上下文.
SetUserUUID 將User UUID寫入上下文.

# Structs

No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author