response

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeSuccess    = 0
	CodeBusiness   = 1
	CodeUnexpected = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data any    `json:"data,omitempty"`
}

func BusinessError

func BusinessError(msg string, data ...any) *Response

func New

func New(code int, msg string, data any) *Response

func Success

func Success(data any, msg ...string) *Response

func UnexpectedError

func UnexpectedError(msg ...string) *Response

func (*Response) With

func (r *Response) With(code int) *Response

Jump to

Keyboard shortcuts

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