response

package
v0.0.0-...-fa63688 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Service     string      `json:"service"`
	Description string      `json:"description"`
	Time        string      `json:"time"`
	Host        string      `json:"host"`
	Method      string      `json:"method"`
	Result      bool        `json:"result"`
	Error       string      `json:"error"`
	Data        interface{} `json:"data"`
}

Data Response json data

func NewResponseData

func NewResponseData(req *fasthttp.RequestCtx, service string, descr string) *Data

NewResponseData Make new struct

type Response

type Response struct {
	// contains filtered or unexported fields
}

Response is used for simple answ to client

func NewResponse

func NewResponse(writer *fasthttp.RequestCtx, service string, descr string) *Response

NewResponse make new struct

func (*Response) Send

func (r *Response) Send(response string, code int) error

Send abstraction of response sending

func (*Response) SendFail

func (r *Response) SendFail(reason string) error

SendFail simple sends fail result to client

func (*Response) SendJSON

func (r *Response) SendJSON(data interface{}) error

SendJSON Send JSON response

Jump to

Keyboard shortcuts

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