jsend

package
v4.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: BSD-3-Clause, MIT, OFL-1.1 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Success is the return code indicating "All went well, and (usually) some data was returned".
	Success = "success"

	// Fail is the return code indicating "There was a problem with the data submitted, or some pre-condition of the API call wasn't satisfied".
	Fail = "fail"

	// Error is the return code indicating "An error occurred in processing the request, i.e. an exception was thrown".
	Error = "error"
)

Variables

This section is empty.

Functions

func JSONWrite

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

JSONWrite writes out data as JSON, sending headers and content length

func Send

func Send(w http.ResponseWriter, status string, data interface{})

Send sends arbitrary data as a JSend response

func Sendf

func Sendf(w http.ResponseWriter, status, short string, format string, a ...interface{})

Sendf sends a Sprintf()-formatted string as a JSend response

Types

This section is empty.

Jump to

Keyboard shortcuts

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