resp

package
v0.0.0-...-3839eb7 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {

	// custom CustomCode
	CustomCode int `json:"code"`
	// response mgs
	Message string `json:"msg,omitempty"`
	// response Payload
	Payload any `json:"data,omitempty"`
	// response ErrorMsg
	ErrorMsg string `json:"error,omitempty"`
	// contains filtered or unexported fields
}

func Fail

func Fail(ctx *gin.Context) *Response

Fail means that the request is unsuccessful, the result usually caused by client, not server like incorrect parameters

func Forbidden

func Forbidden(ctx *gin.Context) *Response

func InternalFailed

func InternalFailed(ctx *gin.Context) *Response

InternalFailed means that the request is unsuccessful, the reason usually caused by server

func NewResponse

func NewResponse(ctx *gin.Context) *Response

func Ok

func Ok(ctx *gin.Context) *Response

Ok means that the request is successful.

func Status

func Status(ctx *gin.Context, statusCode int) *Response

Status response with status code

func UnAuthorized

func UnAuthorized(ctx *gin.Context) *Response

func (*Response) Code

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

func (*Response) Data

func (r *Response) Data(data any) *Response

func (*Response) Error

func (r *Response) Error(err error) *Response

func (*Response) Msg

func (r *Response) Msg(msg string) *Response

func (*Response) MsgI18n

func (r *Response) MsgI18n(langCode string) *Response

func (*Response) Send

func (r *Response) Send()

func (*Response) Status

func (r *Response) Status(status int) *Response

func (*Response) Transparent

func (r *Response) Transparent() *Response

Jump to

Keyboard shortcuts

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