Back to godoc.org

Package web

v1.5.5
Latest Go to latest

The latest major version is .

Published: Sep 21, 2020 | License: Apache-2.0 | Module: github.com/sunmi-OS/gocore

Index

Constants

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

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

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 RecoverInfo

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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier