Documentation
¶
Index ¶
- Constants
- func GetPageIndex(c *gin.Context) int
- func GetPageSize(c *gin.Context) int
- func GetPaginationParam(c *gin.Context) *schema.PaginationParam
- func GetToken(c *gin.Context) string
- func GetTraceID(c *gin.Context) string
- func GetUserID(c *gin.Context) int
- func GetUserUUID(c *gin.Context) string
- func NewContext(c *gin.Context) context.Context
- func ParseJSON(c *gin.Context, obj interface{}) error
- func ResError(c *gin.Context, err error, status ...int)
- func ResJSON(c *gin.Context, status int, v interface{})
- func ResList(c *gin.Context, v interface{})
- func ResOK(c *gin.Context)
- func ResPage(c *gin.Context, v interface{}, pr *schema.PaginationResult)
- func ResSuccess(c *gin.Context, v interface{})
- func SetUserID(c *gin.Context, userID int)
- func SetUserUUID(c *gin.Context, userUUID string)
Constants ¶
View Source
const ( // UserIDKey - Key in the storage context (user ID) UserIDKey = prefix + "/user-id" // UserUUIDKey - Key in the storage context (user UUID) UserUUIDKey = prefix + "/user-uuid" // TraceIDKey - Key in storage context (tracking ID) TraceIDKey = prefix + "/trace-id" // ResBodyKey - The key in the storage context (response to the Body data) ResBodyKey = prefix + "/res-body" )
Define the keys in the context
Variables ¶
This section is empty.
Functions ¶
func GetPageSize ¶
GetPageSize - Get the page size of the page (up to 50)
func GetPaginationParam ¶
func GetPaginationParam(c *gin.Context) *schema.PaginationParam
GetPaginationParam - Get paging query parameters
func NewContext ¶
NewContext - Package context entry
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.