response

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(w http.ResponseWriter, err error)

func Error

func Error(w http.ResponseWriter, err error)

func InternalServerError added in v1.3.1

func InternalServerError(w http.ResponseWriter)

func OK

func OK(w http.ResponseWriter, data interface{})

func OKChar

func OKChar(w http.ResponseWriter, isBanned bool, isAdmin bool, data interface{})

func Result

func Result(w http.ResponseWriter, b bool)

func TooManyRequests added in v1.3.0

func TooManyRequests(w http.ResponseWriter)

Types

type Response

type Response struct {
	Code     int         `json:"code"`
	Status   bool        `json:"status"`
	Error    string      `json:"error"`
	Data     interface{} `json:"data"`
	IsBanned *bool       `json:"isBanned,omitempty"`
	IsAdmin  *bool       `json:"isAdmin,omitempty"`
	// contains filtered or unexported fields
}

make public so other packages can create custom responses.

func (*Response) SendJson

func (r *Response) SendJson()

Jump to

Keyboard shortcuts

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