response

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Response

func Response(w http.ResponseWriter, resp interface{}, err error)

Response 处理 HTTP 响应,支持 ApiError 进行错误处理

Types

type Body

type Body struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data,omitempty"` // 仅当有数据时才包含 Data 字段
}

func CodeResponse

func CodeResponse(code int, msg string, data interface{}) Body

CodeResponse 提供自定义响应方法

Jump to

Keyboard shortcuts

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