Documentation ¶
Index ¶
- Constants
- func Fail(ctx *gin.Context)
- func FailWithDetailed[T interface{}](data T, message string, ctx *gin.Context)
- func FailWithMessage(message string, ctx *gin.Context)
- func NoAuth(message string, ctx *gin.Context)
- func Ok(ctx *gin.Context)
- func OkWithData[T interface{}](data T, ctx *gin.Context)
- func OkWithDetailed[T interface{}](data T, message string, ctx *gin.Context)
- func OkWithMessage(message string, ctx *gin.Context)
- func Result[T interface{}](code int, data T, msg string, ctx *gin.Context)
- type ApiResponse
- func ApiBadRequestResp(msgs ...any) *ApiResponse[any]
- func ApiForbiddenResp(msgs ...any) *ApiResponse[any]
- func ApiInternalServerErrorResp(msgs ...any) *ApiResponse[any]
- func ApiNotFoundResp(msgs ...any) *ApiResponse[any]
- func ApiNotImplementedResp(msgs ...any) *ApiResponse[any]
- func ApiSuccessResp[T interface{}](data T, msgs ...any) *ApiResponse[T]
- type BasePageInfo
- type Empty
- type Failure
- type IdJson
- type IdUriRequest
- type IdsReq
- type IdsReqInt
- type IdsReqStr
- type JsonWithId
- type JsonWithIdInt
- type JsonWithIdStr
- type PageInfo
- type UpdateStatusRequest
Constants ¶
View Source
const ( ERROR = 7 SUCCESS = 0 )
Variables ¶
This section is empty.
Functions ¶
func FailWithDetailed ¶
func FailWithMessage ¶
func OkWithData ¶
func OkWithDetailed ¶
func OkWithMessage ¶
Types ¶
type ApiResponse ¶
type ApiResponse[T interface{}] struct { Code int `json:"code"` Data T `json:"data,omitempty"` Message interface{} `json:"message,omitempty"` }
func ApiBadRequestResp ¶
func ApiBadRequestResp(msgs ...any) *ApiResponse[any]
func ApiForbiddenResp ¶
func ApiForbiddenResp(msgs ...any) *ApiResponse[any]
func ApiInternalServerErrorResp ¶
func ApiInternalServerErrorResp(msgs ...any) *ApiResponse[any]
func ApiNotFoundResp ¶
func ApiNotFoundResp(msgs ...any) *ApiResponse[any]
func ApiNotImplementedResp ¶
func ApiNotImplementedResp(msgs ...any) *ApiResponse[any]
func ApiSuccessResp ¶
func ApiSuccessResp[T interface{}](data T, msgs ...any) *ApiResponse[T]
type BasePageInfo ¶
type IdUriRequest ¶
type IdUriRequest struct {
Id string `uri:"id"` // 主键ID
}
type JsonWithId ¶
type JsonWithId[T any] struct { Id T `json:"id"` // 主键ID }
func (*JsonWithId[T]) GetId ¶
func (j *JsonWithId[T]) GetId() T
type JsonWithIdInt ¶
type JsonWithIdInt = JsonWithId[int]
type JsonWithIdStr ¶
type JsonWithIdStr = JsonWithId[string]
type PageInfo ¶
type PageInfo struct { BasePageInfo Keyword string `json:"keyword"` // 关键字 }
PageInfo Paging common input parameter structure
type UpdateStatusRequest ¶
Click to show internal directories.
Click to hide internal directories.