response

package
v0.0.0-...-83330ae Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithError

func WithError(err error) func(*Response) *Response

func WithHttpCode

func WithHttpCode(httpCode int) func(*Response) *Response

func WithMessage

func WithMessage(message string) func(*Response) *Response

func WithPayload

func WithPayload(payload interface{}) func(*Response) *Response

Types

type Response

type Response struct {
	HttpCode int         `json:"-"`
	Success  bool        `json:"success"`
	Message  string      `json:"message"`
	Payload  interface{} `json:"payload,omitempty"`
}

func New

func New(params ...func(*Response) *Response) Response

func (Response) Send

func (r Response) Send(ctx *gin.Context)

func (Response) SendAbort

func (r Response) SendAbort(ctx *gin.Context)

Jump to

Keyboard shortcuts

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