Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PaginationResultTransform ¶ added in v0.2.8
func PaginationResultTransform[Src any, Dst any]( dst *PaginationResult[Dst], src *PaginationResult[Src], f func(dst *Dst, src *Src))
Types ¶
type AppResponse ¶
type AppResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
func NewDataResponse ¶
func NewDataResponse(data interface{}) AppResponse
func NewErrorCodeResponse ¶
func NewErrorCodeResponse(err *errcode.Error) AppResponse
func NewErrorResponse ¶
func NewErrorResponse(code int, err error) AppResponse
func NewOkResponse ¶
func NewOkResponse() AppResponse
func TryErrorCodeResponse ¶
func TryErrorCodeResponse(err error) AppResponse
type JsonResponse ¶ added in v0.2.6
type JsonResponse map[string]interface{}
type PageResult ¶
type PaginationParam ¶
type PaginationParam struct {
Offset int `json:"offset" bson:"offset"` // Page is the page number, starts from 0
Limit int `json:"limit" bson:"limit"` // Size is the page size
}
PaginationParam is a *interface* struct provide interface for all common pagination parameter
type PaginationResult ¶
type PaginationResult[T any] struct { Total int64 `json:"total" bson:"total"` Offset int64 `json:"offset" bson:"offset"` Results []T `json:"results" bson:"results"` Count int64 `json:"count" bson:"count"` }
PaginationResult is a *interface* struct provide interface for all common pagination response
Click to show internal directories.
Click to hide internal directories.