resp

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIError

func APIError(c echo.Context, err error) error

APIError 返回API错误

func ListDataResponse

func ListDataResponse(c echo.Context, arr interface{}, total int64) error

func OneDataResponse

func OneDataResponse(c echo.Context, data interface{}) error

func OperateSuccess

func OperateSuccess(c echo.Context) error

Types

type DataResponse

type DataResponse struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

type ErrorResponse added in v1.0.2

type ErrorResponse struct {
	Code      int    `json:"code"`       // 业务错误码
	Message   string `json:"message"`    // 错误消息
	RequestID string `json:"request_id"` // 请求ID(用于追踪)
	Timestamp int64  `json:"timestamp"`  // 错误发生时间戳
}

ErrorResponse 统一错误响应结构

type ListData

type ListData struct {
	Total int64       `json:"total"`
	List  interface{} `json:"list" `
}

type ListResponse

type ListResponse struct {
	Code int      `json:"code"`
	Msg  string   `json:"msg"`
	Data ListData `json:"data"`
}

Jump to

Keyboard shortcuts

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