response

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadJSON

func ReadJSON(w http.ResponseWriter, r *http.Request, data any) error

func WriteJSON

func WriteJSON(w http.ResponseWriter, httpStatus int, data Response, headers ...http.Header) error

Types

type Response

type Response struct {
	Success bool           `json:"success"`
	Message string         `json:"message"`
	Data    map[string]any `json:"data"`
}

func (*Response) SetData

func (r *Response) SetData(key string, value any) *Response

func (*Response) SetMessage

func (r *Response) SetMessage(message string) *Response

func (*Response) SetModel added in v1.3.3

func (r *Response) SetModel(model any, key string) error

func (*Response) SetSuccess added in v1.3.2

func (r *Response) SetSuccess(success bool) *Response

Jump to

Keyboard shortcuts

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