response

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CodeMsgMap = map[int]string{}
	ShowMore   = true
)

Functions

func SetCode

func SetCode(v *int, code int)

func SetData

func SetData(v *interface{}, data interface{})

func SetErrCode

func SetErrCode(c *int, m *string, code int)

func SetError

func SetError(c *[]string, errs ...error)

func SetMeta

func SetMeta(v *interface{}, meta interface{})

func SetMsg

func SetMsg(v *string, msg string, msgArgs ...interface{})

Types

type Error added in v1.0.1

type Error interface {
	error
	Code() int
}

type ErrorDefault added in v1.0.1

type ErrorDefault struct {
	ErrMsg  string
	ErrCode int
}

func (*ErrorDefault) Code added in v1.0.1

func (v *ErrorDefault) Code() int

func (*ErrorDefault) Error added in v1.0.1

func (v *ErrorDefault) Error() string

type Response

type Response interface {
	SetErrCode(int) Response
	SetCustomError(Error) Response
	SetErrMsg(int, string, ...interface{}) Response
	SetData(interface{}) Response
	SetDataMsg(interface{}, string, ...interface{}) Response
	SetMeta(interface{}) Response
	AddError(...error) Response
}

func New

func New() Response

Jump to

Keyboard shortcuts

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