response

package
v2.13.2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: CC0-1.0 Imports: 14 Imported by: 0

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) bool

func (*JSON) ExpiredToken

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

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