echocontroller

package module
v0.0.0-...-b860ac0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReturnDataMessage

func ReturnDataMessage(c echo.Context, code int, msg string, data interface{}) error

func ReturnDataMessageU

func ReturnDataMessageU(c echo.Context, code int, msg string, data interface{}) error

func ReturnError

func ReturnError(c echo.Context, err error) error

func ReturnErrorU

func ReturnErrorU(c echo.Context, err error) error

func ReturnListDataMessage

func ReturnListDataMessage(c echo.Context, code int, msg string, data []interface{}) error

func ReturnListDataMessageU

func ReturnListDataMessageU(c echo.Context, code int, msg string, data []interface{}) error

func ReturnMessage

func ReturnMessage(c echo.Context, code int, msg string) error

func ReturnMessageU

func ReturnMessageU(c echo.Context, code int, msg string) error

func TryGetQueryString

func TryGetQueryString(c echo.Context, names ...string) string

获取请求参数

Types

type Controller

type Controller struct {
	Context *echo.Echo
	Group   *echo.Group
	// contains filtered or unexported fields
}

/defin controller

func (*Controller) AddHandle

func (c *Controller) AddHandle(m MethodType, p string, h echo.HandlerFunc)

func (*Controller) RegisterController

func (c *Controller) RegisterController()

type ControllerMethod

type ControllerMethod struct {
	Method MethodType
	Path   string
	Handle echo.HandlerFunc
}

/define api function

type EchoServer

type EchoServer struct {
	Context *echo.Echo
	// contains filtered or unexported fields
}

/define server

func New

func New() *EchoServer

/build server

func (*EchoServer) NewController

func (c *EchoServer) NewController(path string) *Controller

func (*EchoServer) RegisterController

func (c *EchoServer) RegisterController()

func (*EchoServer) Start

func (c *EchoServer) Start(host string, port string)

type HTTPDataResponse

type HTTPDataResponse struct {
	HttpResponse
	Data interface{} `json:"Data"`
}

type HTTPListResponse

type HTTPListResponse struct {
	HttpResponse
	Data []interface{} `json:"Data"`
}

type HTTPPageResponse

type HTTPPageResponse struct {
	PageSize   int           `json:"PageSize"`
	PageNo     int           `json:"PageNo"`
	TotalCount int           `json:"TotalCount"`
	TotalPage  int           `json:"TotalPage"`
	Data       []interface{} `json:"Data"`
}

type HTTPResponse

type HTTPResponse struct {
	Code    int    `json:"Code"`
	Message string `json:"Message"`
}

type HttpDataResponse

type HttpDataResponse struct {
	HttpResponse
	Data interface{} `json:"data"`
}

type HttpListResponse

type HttpListResponse struct {
	HttpResponse
	Data []interface{} `json:"data"`
}

type HttpPageResponse

type HttpPageResponse struct {
	PageSize   int           `json:"pageSize"`
	PageNo     int           `json:"pageNo"`
	TotalCount int           `json:"totalCount"`
	TotalPage  int           `json:"totalPage"`
	Data       []interface{} `json:"data"`
}

type HttpResponse

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

type MethodType

type MethodType uint32

/define http method

const (
	GET MethodType = 1 + iota
	POST
	PUT
	DELETE
)

Jump to

Keyboard shortcuts

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