core

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle

func Handle(next HandlerFunc) echo.HandlerFunc

Types

type Context

type Context struct {
	echo.Context
}

func (*Context) Bind added in v0.3.0

func (c *Context) Bind(i interface{}) error

func (*Context) OutputJSON

func (c *Context) OutputJSON(Code int, message string, options ...JSONOption) error

Output JSON

Example:

c.OutputJSON(0, "success", c.WithStatusCode(http.StatusOK), c.WithData("hello,world"))

func (*Context) WithData added in v0.3.0

func (c *Context) WithData(data interface{}) JSONOption

WithData set "data" field

func (*Context) WithStatusCode added in v0.3.0

func (c *Context) WithStatusCode(status int) JSONOption

WithStatusCode set http status code

type HandlerFunc

type HandlerFunc func(c *Context) error

type JSONOption added in v0.3.0

type JSONOption func(res *JSONResult)

type JSONResult

type JSONResult struct {
	Status int `json:"-"`

	Code    int         `json:"code"`
	Message string      `json:"msg"`
	Data    interface{} `json:"data,omitempty"`
}

JSONResult json

type Pagination

type Pagination struct {
	Total       int `json:"total"`
	CurrentPage int `json:"current_page"` // current page
}

Pagination

Jump to

Keyboard shortcuts

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