middlewares

package
v0.0.0-...-1efb92b Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Context

func Context() func(http.Handler) http.Handler

Context get user from jwt and put user into ctx

func Cors

func Cors() func(http.Handler) http.Handler

Cors ...

func GetUserInformationFromCtx

func GetUserInformationFromCtx(ctx context.Context) (*enum.AuthJWT, error)

func HasLoginFunc

func HasLoginFunc(ctx context.Context, obj interface{}, next graphql.Resolver) (interface{}, error)

HasLoginFunc 如果是请求需要登录才能访问的接口,则需要判断是否带有 token ,并检测 token 的合法性,如果失败拒绝请求

func MiddleError

func MiddleError(ctx context.Context, err error) *gqlerror.Error

MiddleError 全局錯誤處理

func RecoverFunc

func RecoverFunc(ctx context.Context, err interface{}) (userMessage error)

RecoverFunc ...

func Safety

func Safety() func(handler http.Handler) http.Handler

Types

This section is empty.

Jump to

Keyboard shortcuts

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