response

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 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 {
	Status  bool           `json:"status"`
	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) SetStatus

func (r *Response) SetStatus(status bool) *Response

Jump to

Keyboard shortcuts

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