response

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: CC0-1.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExportFile

type ExportFile struct {
	Name    string        `json:"name"`
	Content *bytes.Buffer `json:"-"`
}

type JSON

type JSON struct {
	Code        int         `json:"code"`
	Message     string      `json:"message"`
	MessageDesc string      `json:"description,omitempty"`
	Error       error       `json:"-"`
	Data        interface{} `json:"data,omitempty"`
	Latency     float64     `json:"latency"`
	TraceId     string      `json:"trace_id,omitempty"`
	ExportFile  *ExportFile `json:"-"`
}

func NewJSON

func NewJSON() *JSON

func (*JSON) BadRequest

func (jr *JSON) BadRequest(err error) *JSON

func (*JSON) ErrorChecking

func (jr *JSON) ErrorChecking(r *http.Request, notif notifications.Platforms) bool

func (*JSON) Export

func (jr *JSON) Export(fileName string, content *bytes.Buffer) *JSON

func (*JSON) ForbiddenResource

func (jr *JSON) ForbiddenResource(err error) *JSON

func (*JSON) InternalServerError

func (jr *JSON) InternalServerError(err error) *JSON

func (*JSON) Send

func (jr *JSON) Send(w http.ResponseWriter)

func (*JSON) SetCode

func (jr *JSON) SetCode(code int) *JSON

func (*JSON) SetData

func (jr *JSON) SetData(data interface{}) *JSON

func (*JSON) SetError

func (jr *JSON) SetError(errCode int, err error) *JSON

func (*JSON) SetMessage

func (jr *JSON) SetMessage(msg string) *JSON

func (*JSON) Success

func (jr *JSON) Success(data interface{}) *JSON

func (*JSON) Unauthorized

func (jr *JSON) Unauthorized(err error) *JSON

Jump to

Keyboard shortcuts

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