response

package
v0.0.0-...-6a802dc Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(ctx *gin.Context)

func NotFound

func NotFound(ctx *gin.Context)

func Ok

func Ok(ctx *gin.Context, data interface{})

func OkPaged

func OkPaged(ctx *gin.Context, page *page.Page, total int, data interface{})

Types

type ErrorResponse

type ErrorResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func NewError

func NewError(code int) *ErrorResponse

type Response

type Response struct {
	Meta  *ResponseMeta   `json:"meta"`
	Links *page.PageLinks `json:"links"`
	Data  interface{}     `json:"data"`
}

func New

func New(data interface{}) *Response

func NewPaged

func NewPaged(p *page.Page, total int, data interface{}) *Response

type ResponseMeta

type ResponseMeta struct {
	Total int `json:"total"`
	Pages int `json:"pages"`
}

Jump to

Keyboard shortcuts

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