Documentation
¶
Index ¶
- Variables
- func Fail(c *gin.Context, status Status)
- func FailHttpCode(c *gin.Context, code int, status Status)
- func FailInternalError(c *gin.Context)
- func FailWithMsg(c *gin.Context, msg string)
- func Ok(c *gin.Context)
- func OkWithData(c *gin.Context, data any)
- func OkWithMsg(c *gin.Context, msg string)
- type KeysetPage
- type KeysetPaginatedData
- type PageInfo
- type PaginatedData
- type Response
- type Status
- type StatusCode
Constants ¶
This section is empty.
Variables ¶
View Source
var ( StatusSuccess = Status{Code: CodeSuccess, Msg: "success"} StatusInvalidParams = Status{Code: CodeErrorInvalidParams, Msg: "invalid params"} StatusDatabase = Status{Code: CodeErrorDatabase, Msg: "database error"} StatusUserNotExist = Status{Code: CodeErrorUserNotExist, Msg: "user not exist"} StatusPassword = Status{Code: CodeErrorPassword, Msg: "password error"} StatusTokenExpired = Status{Code: CodeErrorTokenExpired, Msg: "token expired"} StatusForbidden = Status{Code: CodeErrorForbidden, Msg: "forbidden"} StatusInternalServerError = Status{Code: CodeErrorInternalServerError, Msg: "internal server error"} )
Functions ¶
func FailInternalError ¶
func FailWithMsg ¶
func OkWithData ¶
Types ¶
type KeysetPage ¶ added in v0.6.4
type KeysetPage struct {
// How many items to return per page.
Limit int `json:"limit" form:"limit" binding:"required,min=1,max=100"`
// Field name to sort by (e.g., "created_at", "name").
// Must be a field suitable for keyset pagination (indexed, relatively unique).
SortBy string `json:"sortBy" form:"sortBy" binding:"required"`
// default is ASC, if true, then DESC
DESC bool `json:"desc" form:"desc"`
// An opaque cursor indicating the last item from the previous page (for forward pagination).
// The client should send the 'nextCursor' received from the previous response here.
After any `json:"after" form:"after"`
// An opaque cursor indicating the first item from the previous page (for backward pagination).
// The client should send the 'previousCursor' received from the previous response here.
Before any `json:"before" form:"before"`
}
type KeysetPaginatedData ¶ added in v0.6.4
type PaginatedData ¶ added in v0.6.4
type Status ¶
type Status struct {
Code StatusCode `json:"code"`
Msg string `json:"msg"`
}
type StatusCode ¶
type StatusCode int
const ( CodeSuccess StatusCode = 1 CodeError StatusCode = 0 CodeErrorInvalidParams StatusCode = 2001 CodeErrorDatabase StatusCode = 2002 CodeErrorUserNotExist StatusCode = 2003 CodeErrorPassword StatusCode = 2004 CodeErrorTokenExpired StatusCode = 2005 CodeErrorInternalServerError StatusCode = 2007 CodeErrorForbidden StatusCode = 2008 )
Click to show internal directories.
Click to hide internal directories.