ginx

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LimiterMiddleware

func LimiterMiddleware(limit int) gin.HandlerFunc

func SetDefaultErrorCode

func SetDefaultErrorCode(code int) error

func SetLog added in v1.3.0

func SetLog(l logger.Logger)

func TimeoutMiddleware

func TimeoutMiddleware(millSecond int) gin.HandlerFunc

Types

type AsciiJSON

type AsciiJSON = render.AsciiJSON

type Data

type Data = render.Data

type GinError

type GinError struct {
	Code int
	Msg  string
}

func NewGinError

func NewGinError(code int, msg string) GinError

func (GinError) Error

func (e GinError) Error() string

type GinHandler

type GinHandler func(c *gin.Context) Render

GinHandler gin.HandleFunc with Render interface

type GinOption

type GinOption func(*gin.Engine)

GinOption set properties of gin.Engine instance

func WithContextWithFallback

func WithContextWithFallback(fallback bool) GinOption

WithContextWithFallback set ContextWithFallback

func WithForwardedByClientIP

func WithForwardedByClientIP(forwarded bool) GinOption

WithForwardedByClientIP set ForwardedByClientIP

func WithHandleMethoNotAllowed

func WithHandleMethoNotAllowed(allowed bool) GinOption

WithHandleMethoNotAllowed set HandleMethodNotAllowed

func WithMaxMultipartMemory

func WithMaxMultipartMemory(memory int64) GinOption

WithMaxMultipartMemory set MaxMultipartMemory

func WithRedirectFixedPath

func WithRedirectFixedPath(redirect bool) GinOption

WithRedirectFixedPath set RedirectFixedPath

func WithRedirectTrailingSlash

func WithRedirectTrailingSlash(redirect bool) GinOption

WithRedirectTrailingSlash set RedirectTrailingSlash

func WithRemoteIPHeaders

func WithRemoteIPHeaders(headers []string) GinOption

WithRemoteIPHeaders set RemoteIPHeaders

func WithRemoveExtraSlash

func WithRemoveExtraSlash(remove bool) GinOption

WithRemoveExtraSlash set RemoveExtraSlash

func WithTrustedPlatform

func WithTrustedPlatform(trusted string) GinOption

WithTrustedPlatform set TrustedPlatform

func WithUnescapePathValues

func WithUnescapePathValues(unescape bool) GinOption

WithUnescapePathValues set UnescapePathValues

func WithUseH2C

func WithUseH2C(h2c bool) GinOption

WithUseH2C set UseH2C

func WithUseRawPath

func WithUseRawPath(rawPath bool) GinOption

WithUseRawPath set UseRawPath

type GinRouters

type GinRouters interface {
	// Use resgister middleware
	Use(handler ...gin.HandlerFunc) GinRouters
	// Handle use GinHandler to register route
	Handle(method, path string, handler GinHandler) GinRouters
}

GinRouters register route

type HTML

type HTML = render.HTML

type HTMLDebug

type HTMLDebug = render.HTMLDebug

type HTMLProduction

type HTMLProduction = render.HTMLProduction

type IndentedJSON

type IndentedJSON = render.IndentedJSON

type JSON

type JSON = render.JSON

type JsonpJSON

type JsonpJSON = render.JsonpJSON

type Reader

type Reader = render.Reader

type Redirect

type Redirect = render.Redirect

type Render

type Render = render.Render

func Error

func Error(err error) Render

func ResponseData

func ResponseData(code int, msg string, data interface{}) Render

func Success

func Success(data interface{}) Render

type Response

type Response struct {
	Code      int         `json:"code"`
	Msg       string      `json:"msg"`
	Data      interface{} `json:"data"`
	Timestamp int64       `json:"timestamp"`
}

type SecureJSON

type SecureJSON = render.SecureJSON

type String

type String = render.String

type XML

type XML = render.XML

type YAML

type YAML = render.YAML

type ZeroGinRouter

type ZeroGinRouter interface {
	GinRouters
	// Group create and return new router group
	Group(path string) ZeroGinRouter
	// Handler return http.Handler
	Handler() http.Handler
}

ZeroGinRouter route manage

func NewZeroGinRouter

func NewZeroGinRouter(opts ...GinOption) ZeroGinRouter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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