goresp

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2020 License: BSD-2-Clause Imports: 5 Imported by: 1

README

goresp

response json standart

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBody

func ParseBody(r io.ReadCloser, data interface{}) goerr.IError

func Send

func Send(writer http.ResponseWriter, response *Response)

func SendJson

func SendJson(writer http.ResponseWriter, httpCode int, data interface{})

Types

type Pagination

type Pagination struct {
	Page  int `json:"page,omitempty"`
	Limit int `json:"limit,omitempty"`
	Total int `json:"total,omitempty"`
}

Pagination

type Response

type Response struct {
	HttpCode   int         `json:"-"`
	Message    interface{} `json:"message,omitempty"`
	Data       interface{} `json:"data,omitempty"`
	Pagination interface{} `json:"pagination,omitempty"`
	Error      interface{} `json:"error,omitempty"`
}

func Error

func Error(e goerr.IError) *Response

func Ok

func Ok(message interface{}, data interface{}, pagination interface{}) *Response

Jump to

Keyboard shortcuts

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