web

package
v1.5.20 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeOctetStream = "application/octet-stream"
	TypeForm        = "application/x-www-form-urlencoded"
	TypeJson        = "application/json"
	TypeXml         = "application/xml"
	TypeJpg         = "image/jpeg"
	TypePng         = "image/png"
)

Variables

This section is empty.

Functions

func File

func File(c interface{}, filePath, fileName string)

File c: gin or echo Context

func JSON

func JSON(c interface{}, data interface{}, err error)

JSON c: gin or echo Context

func Redirect

func Redirect(c interface{}, location string)

Redirect c: gin or echo Context

Types

type CommonRsp

type CommonRsp struct {
	Code    int         `json:"code"`
	Message string      `json:"msg"`
	Data    interface{} `json:"data"`
}

type Config

type Config struct {
	// http host
	Host string
	// http export port  :8080
	Port string
}

type EchoEngine

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

func InitEcho

func InitEcho(c *Config) *EchoEngine

func (*EchoEngine) Logger

func (e *EchoEngine) Logger() echo.MiddlewareFunc

Logger echo middleware logger

func (*EchoEngine) Recover

func (e *EchoEngine) Recover() echo.MiddlewareFunc

Recover echo middleware recover

func (*EchoEngine) Release

func (e *EchoEngine) Release() *EchoEngine

Release

func (*EchoEngine) Start

func (e *EchoEngine) Start(banner ...string)

type GinEngine

type GinEngine struct {
	Gin *gin.Engine
	// contains filtered or unexported fields
}

func InitGin

func InitGin(c *Config) *GinEngine

func (*GinEngine) CORS

func (g *GinEngine) CORS() gin.HandlerFunc

CORS gin middleware cors

func (*GinEngine) Recovery

func (g *GinEngine) Recovery() gin.HandlerFunc

Recovery gin middleware recovery

func (*GinEngine) Release

func (g *GinEngine) Release() *GinEngine

Release release

func (*GinEngine) Start

func (g *GinEngine) Start(banner ...string)

type Pager added in v1.5.9

type Pager struct {
	PageNo   int `json:"page_no"`
	PageSize int `json:"page_size"`
}

func (Pager) Apply added in v1.5.9

func (p Pager) Apply(total int, data interface{}) interface{}

type RecoverInfo

type RecoverInfo struct {
	Time  string      `json:"time"`
	Url   string      `json:"url"`
	Err   string      `json:"error"`
	Query interface{} `json:"query"`
	Stack string      `json:"stack"`
}

Jump to

Keyboard shortcuts

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