Documentation ¶
Index ¶
- Constants
- func Fail(c *gin.Context, status int)
- func FailWithCode(c *gin.Context, status, code int)
- func FailWithCodeData(c *gin.Context, status, code int, data interface{})
- func FailWithCodeMsg(c *gin.Context, status, code int, msg string)
- func FailWithError(c *gin.Context, status int, err error)
- func FailWithMsg(c *gin.Context, status int, msg string)
- func GetBody(c *gin.Context) []byte
- func GetToken(c *gin.Context) string
- func GetUserID(c *gin.Context) int
- func GetUserName(c *gin.Context) string
- func JSON(c *gin.Context, status int, data interface{})
- func OK(c *gin.Context)
- func OkWithData(c *gin.Context, data interface{})
- func OkWithDataMsg(c *gin.Context, data interface{}, msg string)
- func ParseForm(c *gin.Context, obj interface{}) error
- func ParseJSON(c *gin.Context, obj interface{}) error
- func ParseQuery(c *gin.Context, obj interface{}) error
- func Result(c *gin.Context, status, code int, msg string, data interface{})
- func ResultWithCode(c *gin.Context, status, code int)
- func ResultWithCodeData(c *gin.Context, status, code int, data interface{})
- func SetUserID(c *gin.Context, userID int)
- func SetUserName(c *gin.Context, userName string)
- func Success(c *gin.Context, status int, data interface{})
- type Response
Constants ¶
View Source
const ( UserIDKey = prefix + "/user-id" UserNameKey = prefix + "/user-name" RoleIDKey = prefix + "/role-id" RoleKey = prefix + "/role-key" RoleNameKey = prefix + "/role-name" DataScopeKey = prefix + "/data-scope" ReqBodyKey = prefix + "/req-body" ResBodyKey = prefix + "/res-body" LoggerReqBodyKey = prefix + "/logger-req-body" )
定义上下文中的键
View Source
const ( SuccessStatus = 200 FailStatus = -1 )
Variables ¶
This section is empty.
Functions ¶
func FailWithCodeData ¶
FailWithCodeData FailWithCodeData
func FailWithCodeMsg ¶
FailWithCodeMsg FailWithCodeMsg
func FailWithError ¶
FailWithError FailWithError
func OkWithDataMsg ¶
OkWithDataMsg OkWithDataMsg
func ResultWithCode ¶
ResultWithCode ResultWithCode
func ResultWithCodeData ¶
ResultWithCodeData ResultWithCodeData
Types ¶
Click to show internal directories.
Click to hide internal directories.