request

package
v0.11.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const CONTEXT_CLAIM_KEY = "TOTOVAL_CONTEXT_CLAIM"
View Source
const CONTEXT_IUSER_KEY = "TOTOVAL_CONTEXT_IUSER"

Variables

This section is empty.

Functions

func ConvertHandlers

func ConvertHandlers(handlers []HandlerFunc) (ginHandlers []gin.HandlerFunc)

func ConvertWsHandlers

func ConvertWsHandlers(handlers []HandlerFunc) (ginHandlers []gin.HandlerFunc)

Types

type CommonContext

type CommonContext struct {
	*gin.Context
}

func (*CommonContext) Accepted

func (c *CommonContext) Accepted() []string

func (*CommonContext) AuthClaimID

func (c *CommonContext) AuthClaimID() (ID uint, exist bool)

func (*CommonContext) Errors

func (c *CommonContext) Errors() []*gin.Error

func (*CommonContext) GinContext

func (c *CommonContext) GinContext() *gin.Context

func (*CommonContext) IUserModel

func (c *CommonContext) IUserModel() auth.IUser

func (*CommonContext) Keys

func (c *CommonContext) Keys() map[string]interface{}

func (*CommonContext) Params

func (c *CommonContext) Params() gin.Params

func (*CommonContext) Request

func (c *CommonContext) Request() *http.Request

func (*CommonContext) SetAuthClaim

func (c *CommonContext) SetAuthClaim(claims *jwt.UserClaims)

func (*CommonContext) SetIUserModel

func (c *CommonContext) SetIUserModel(iuser auth.IUser)

func (*CommonContext) SetRequest

func (c *CommonContext) SetRequest(r *http.Request)

func (*CommonContext) SetWriter

func (c *CommonContext) SetWriter(w gin.ResponseWriter)

func (*CommonContext) Writer

func (c *CommonContext) Writer() gin.ResponseWriter

type Context

type Context interface {
	// http context
	context.HttpContextor

	GinContext() *gin.Context

	SetAuthClaim(claims *jwt.UserClaims)
	AuthClaimID() (ID uint, exist bool)
	SetIUserModel(iuser auth.IUser)
	IUserModel() auth.IUser
}

type Engine

type Engine struct {
	*gin.Engine
}

func New

func New() *Engine

func (*Engine) GinEngine

func (e *Engine) GinEngine() *gin.Engine

func (*Engine) Use

func (e *Engine) Use(handlers ...HandlerFunc)

func (*Engine) UseGin

func (e *Engine) UseGin(handlerFunc ...gin.HandlerFunc)

type HandlerFunc

type HandlerFunc func(Context)

type WsContext

type WsContext interface {
	Context
	WS() *websocket.Conn
}

type WsHandlerFunc

type WsHandlerFunc func(WsContext)

Jump to

Keyboard shortcuts

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