app_utils

package
v0.0.0-...-65ea52f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindAll

func BindAll(ctx *gin.Context, req interface{}) (err error)

func GenerallyList

func GenerallyList[T any](ctx *gin.Context, db *gorm.DB, dest []T, param ListSearchParam) (out []T, err error)

Types

type GenerallyListReq

type GenerallyListReq struct {
	Page      int               `form:"page" json:"page" query:"page"`
	Size      int               `form:"size" json:"size" query:"size"`
	Like      map[string]string `json:"like" query:"like"`
	Search    map[string]string `json:"search" query:"search"`
	StartTime int64             `form:"start_time" query:"start_time"`
	EndTime   int64             `form:"end_time" query:"end_time"`
	Order     []string          `json:"order"`
}

type GenerallyListResp

type GenerallyListResp struct {
	Items interface{} `json:"items"`
	Total int64       `json:"total"`
	Next  bool        `json:"next"`
}

type ListSearchParam

type ListSearchParam struct {
	Model            interface{}
	MaxSize          int // 为0则代表全部
	Query            string
	QueryCons        []interface{}
	CanSearchAndLike []string // 允许查询的字段
	OrderBy          []string
	Omit             []string // 不需要字段
	Select           []string // 所需字段
	HasDeleted       bool     // 包含删除的行
	NotAutoResp      bool     //  自动封装消息

	SortFn func(i, j int) bool // 排序函数
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL