response

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(c echo.Context, message string, data interface{}, error interface{}) error

func InternalServerError

func InternalServerError(c echo.Context, message string, data interface{}, error interface{}) error

func NotFound

func NotFound(c echo.Context, message string, data interface{}, error interface{}) error

func Paginate

func Paginate(c echo.Context, message string, paginator *paging.OffsetPaginator, data interface{}, error interface{}) error

func SingleData

func SingleData(c echo.Context, message string, data interface{}, error interface{}) error

func Unauthorized

func Unauthorized(c echo.Context, message string, data interface{}, error interface{}) error

func ValidationError

func ValidationError(c echo.Context, message string, data interface{}, error interface{}) error

Types

type APIError

type APIError struct {
	Code    int    `json:"code,omitempty"`
	Type    string `json:"type,omitempty"`
	Field   string `json:"field,omitempty"`
	Message string `json:"message"`
}

APIError

type Link struct {
	NextPageUrl string `json:"next_page_url"`
	PrevPageUrl string `json:"prev_page_url"`
}

type Meta

type Meta struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
}

type MetaPaginator

type MetaPaginator struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
	Page    Paginator   `json:"page"`
}

type Paginator

type Paginator struct {
	Total  int64 `json:"total"`
	Limit  int64 `json:"limit"`
	Offset int64 `json:"offset"`
	Link   Link  `json:"links"`
}

type Paging

type Paging struct {
	MetaPaginator MetaPaginator `json:"meta"`
	Data          interface{}   `json:"data, omitempty"`
}

type Single

type Single struct {
	Meta Meta        `json:"meta"`
	Data interface{} `json:"data, omitempty"`
}

Jump to

Keyboard shortcuts

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