Documentation ¶
Index ¶
- Constants
- Variables
- func Copy[T any](to T, from any, opts ...copier.Option) T
- type BindOption
- type ControllerContext
- type GinControllerContext
- func (c *GinControllerContext) Bind(params any, opts ...BindOption)
- func (c *GinControllerContext) CheckToken(tk Token)
- func (c *GinControllerContext) GetContext() context.Context
- func (c *GinControllerContext) GetPayload() Payload
- func (c GinControllerContext) SetContext(ctx context.Context) ControllerContext
- func (c *GinControllerContext) SetHeader(key, val string)
- type GinFormMultipartFileBinding
- type GinRegister
- type GinRegisterList
- type Paging
- type Payload
- type Result
- type Token
Constants ¶
View Source
const JwtPayloadKey = "JWT_PAYLOAD"
Variables ¶
View Source
var ( // ErrEmptyQueryToken can be thrown if authing with URL Query, the query token variable is empty ErrEmptyQueryToken = errors.New("query token is empty") // ErrEmptyCookieToken can be thrown if authing with a cookie, the token cokie is empty ErrEmptyCookieToken = errors.New("cookie token is empty") // ErrEmptyAuthHeader can be thrown if authing with a HTTP header, the Auth header needs to be set ErrEmptyAuthHeader = errors.New("auth header is empty") // ErrInvalidAuthHeader indicates auth header is invalid, could for example have the wrong Realm name ErrInvalidAuthHeader = errors.New("auth header is invalid") )
Functions ¶
Types ¶
type BindOption ¶
type BindOption uint8
type ControllerContext ¶
type ControllerContext interface { // CheckToken 检查token是否有效 该方法出错会panic 并被panic handler拦截 CheckToken(Token) // GetPayload 获取token中包含的内容 GetPayload() Payload // GetHeader 获取header GetHeader(key string) string // SetHeader 设置header SetHeader(key, val string) // Bind 绑定参数 该方法出错会panic 并被panic handler拦截 Bind(params any, bindings ...BindOption) // SetContext 设置web框架的上下文对象 SetContext(context.Context) ControllerContext // GetContext 获得上下文 GetContext() context.Context }
ControllerContext 请求体接口
type GinControllerContext ¶
GinControllerContext gin 请求体接口实现
func NewGinContext ¶
func NewGinContext(conf *config.Web) *GinControllerContext
func (*GinControllerContext) Bind ¶
func (c *GinControllerContext) Bind(params any, opts ...BindOption)
func (*GinControllerContext) CheckToken ¶
func (c *GinControllerContext) CheckToken(tk Token)
func (*GinControllerContext) GetContext ¶
func (c *GinControllerContext) GetContext() context.Context
func (*GinControllerContext) GetPayload ¶ added in v1.0.9
func (c *GinControllerContext) GetPayload() Payload
func (GinControllerContext) SetContext ¶
func (c GinControllerContext) SetContext(ctx context.Context) ControllerContext
func (*GinControllerContext) SetHeader ¶
func (c *GinControllerContext) SetHeader(key, val string)
type GinFormMultipartFileBinding ¶
type GinFormMultipartFileBinding struct { }
func (GinFormMultipartFileBinding) Bind ¶
func (GinFormMultipartFileBinding) Bind(req *http.Request, ptr any) error
func (GinFormMultipartFileBinding) Name ¶
func (GinFormMultipartFileBinding) Name() string
type GinRegister ¶
type GinRegister struct { Method string Path string Handles []gin.HandlerFunc }
type GinRegisterList ¶
type GinRegisterList []GinRegister
Click to show internal directories.
Click to hide internal directories.