myctx

package
v0.0.0-...-75939a1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormUserId

func FormUserId(ctx context.Context) (uint32, error)

获取用户id

func NewHttpServerContext

func NewHttpServerContext(ctx context.Context, my *Context) context.Context

func WithUserInfoContext

func WithUserInfoContext(ctx context.Context, claims *JwtCustomClaims) context.Context

Types

type Context

type Context struct {
	Writer  http.ResponseWriter
	Request *http.Request
}

func FormHttpContext

func FormHttpContext(ctx context.Context) (*Context, error)

获取登录信息

type JwtCustomClaims

type JwtCustomClaims struct {
	JwtProfile
	UserType string /*client type*/
	jwt.StandardClaims
}

func FormUserInfo

func FormUserInfo(ctx context.Context) (*JwtCustomClaims, error)

获取登录信息

type JwtProfile

type JwtProfile struct {
	ID   uint32 `json:"id"`
	Role string `json:"r"`
}

Jump to

Keyboard shortcuts

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