web

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: Apache-2.0 Imports: 15 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 CheckSign

func CheckSign(sign, appid, path, ts string) (ok bool)

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

func VerifySign

func VerifySign(c *gin.Context)

VerifySign 验证Sign,签名规则,base64(md5(appid+path+ts)) todo: 当前支持60s验证,后续改成单次验证后即失效

Types

type CommonRsp added in v1.0.8

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

type Config added in v1.0.5

type Config struct {
	// http host
	Host string

	// http export port. :8080
	Port string

	// interface limit
	Limit *limit.Config
}

type EchoEngine added in v1.0.8

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

func InitEcho added in v1.0.8

func InitEcho(c *Config) *EchoEngine

func (*EchoEngine) Logger added in v1.0.8

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

Logger echo middleware logger

func (*EchoEngine) Recover added in v1.0.8

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

Recover echo middleware recover

func (*EchoEngine) Release added in v1.0.8

func (e *EchoEngine) Release() *EchoEngine

Release

func (*EchoEngine) Start added in v1.0.8

func (e *EchoEngine) Start()

type GinEngine added in v1.0.8

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

func InitGin added in v1.0.13

func InitGin(c *Config) *GinEngine

func (*GinEngine) CORS added in v1.0.8

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

CORS gin middleware cors

func (*GinEngine) Recovery added in v1.0.8

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

Recovery gin middleware recovery

func (*GinEngine) Release added in v1.0.14

func (g *GinEngine) Release() *GinEngine

func (*GinEngine) Start added in v1.0.8

func (g *GinEngine) Start()

type Pager

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

func (Pager) Apply

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

type RecoverInfo added in v1.0.8

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