rxtx

package
v0.0.0-...-ffb6f1e Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONResponse

type JSONResponse struct {
	Message string      `json:"msg"`
	Result  interface{} `json:"res"`
}

JSONResponse model

func (*JSONResponse) BadRequest400

func (r *JSONResponse) BadRequest400(w http.ResponseWriter, req *http.Request)

BadRequest400 response

func (*JSONResponse) From

func (r *JSONResponse) From(res *Response) *JSONResponse

From Response object

func (*JSONResponse) InternalError500

func (r *JSONResponse) InternalError500(err error, w http.ResponseWriter, req *http.Request)

InternalError500 response

func (*JSONResponse) MethodNotAllowed405

func (r *JSONResponse) MethodNotAllowed405(w http.ResponseWriter, req *http.Request)

MethodNotAllowed405 response

func (*JSONResponse) NotFound404

func (r *JSONResponse) NotFound404(w http.ResponseWriter, req *http.Request)

NotFound404 response

func (*JSONResponse) Raw

func (r *JSONResponse) Raw(w http.ResponseWriter, req *http.Request, status int, data []byte)

Raw response

func (*JSONResponse) Render

func (r *JSONResponse) Render() ([]byte, error)

Render response

func (*JSONResponse) Success200

func (r *JSONResponse) Success200(w http.ResponseWriter, req *http.Request)

Success200 response

func (*JSONResponse) Unauthorized401

func (r *JSONResponse) Unauthorized401(w http.ResponseWriter, req *http.Request)

Unauthorized401 response

func (*JSONResponse) Unavailable503

func (r *JSONResponse) Unavailable503(err error, w http.ResponseWriter, req *http.Request)

Unavailable503 response

type Request

type Request struct {
}

Request model

func (*Request) Bytes

func (req *Request) Bytes(r io.Reader, max uint32) ([]byte, error)

Bytes from the stream

func (*Request) JSON

func (req *Request) JSON(r io.Reader, max uint32, res interface{}) error

JSON struct from the stream

func (*Request) Route

func (req *Request) Route(name, validatorTag string, r *http.Request) (string, *Response)

Route reads route variable (mux.Vars) then validates it. Returns variable on success; response filled with error description on failure

func (*Request) RouteOptional

func (req *Request) RouteOptional(name, validatorTag string, r *http.Request) (string, bool, *Response)

RouteOptional reads route variable (mux.Vars) then validates it if presented. Returns variable or empty string on success; response filled with error description of failure

func (*Request) ValidJSON

func (req *Request) ValidJSON(r io.Reader, res interface{}, max uint32) *Response

ValidJSON reads JSON struct from the stream then validates it. Returns nil on success or response filled with error description

type Response

type Response struct {
	Message string
	Result  interface{}
}

Response model

Jump to

Keyboard shortcuts

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