base

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(ctx *gin.Context, err string)

BadRequest 400 请求错误

func Error

func Error(ctx *gin.Context, err error)

Error 500 服务器错误

func Ok

func Ok(ctx *gin.Context, data ...any)

func Response

func Response(ctx *gin.Context, code int, data ...any)

func Typer

func Typer(i any) string

Types

type IDListRequest

type IDListRequest struct {
	IDList []int `json:"ids" form:"ids" binding:"required"` // *ID列表(必须)
}

type IDRequest

type IDRequest struct {
	ID int `json:"id" form:"id" binding:"required"` // *ID(必须)
}

type ListRequest

type ListRequest struct {
	Page    int    `json:"page" form:"page" binding:"min=1"`
	Size    int    `json:"size" form:"size" binding:"min=1"`
	Keyword string `json:"keyword" form:"keyword"`
	Sort    string `json:"sort" form:"sort" binding:"oneof=asc desc"`
	ID      int    `json:"id" form:"id"`
	Status  int    `json:"status" form:"status"`
}

ListRequest 通用列表请求

type Result

type Result struct {
	Code  int         `json:"code,omitempty"`  // 状态码
	Msg   string      `json:"msg,omitempty"`   // 状态消息
	Total int64       `json:"total,omitempty"` // 总条数
	Data  interface{} `json:"data,omitempty"`  // 数据
}

Jump to

Keyboard shortcuts

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