Documentation
¶
Index ¶
- Variables
- func Error(ctx *gin.Context, err error) *gin.Context
- func Failure(ctx *gin.Context, code int, message string) *gin.Context
- func IsDuplicate[T any, V comparable](list []T, f func(T) V) bool
- func SliceMap[T, U any](slice []T, fn func(T) U) []U
- func Success(ctx *gin.Context, data any) *gin.Context
- func ToMap[K comparable, V any](rows []V, f func(V) (K, V)) map[K]V
- type Pagination
- type Price
- type Time
- type YesOrNo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultSuccessCode int = 0 DefaultSuccessMessage string = "success" DefalutErrorCode int = -1 )
View Source
var DefaultPageSize int = 10
默认每页数量
View Source
var ErrPriceScan = errors.New("价格类型解析失败")
View Source
var TimeDefaultLayout string = "2006-01-02 15:04:05"
时间默认格式
Functions ¶
func IsDuplicate ¶ added in v0.0.2
func IsDuplicate[T any, V comparable](list []T, f func(T) V) bool
IsDuplicate checks if there are any duplicates in a list of items.
Types ¶
type Pagination ¶
type Pagination struct { Page int `json:"page" form:"page"` // 页码 Size int `json:"size" form:"size"` // 每页数量 Keyword string `json:"keyword" form:"keyword"` // 关键字 }
分页
Click to show internal directories.
Click to hide internal directories.