contextx

package
v0.2.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 3 Imported by: 0

README

contextx:使用后缀 x 表示扩展或变体,简洁且易于记忆。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromAccessToken

func FromAccessToken(ctx context.Context) string

FromAccessToken extract accessToken from context.

func FromContext

func FromContext(ctx context.Context) (token *jwt.RegisteredClaims, ok bool)

FromContext extract auth info from context.

func FromUserID

func FromUserID(ctx context.Context) string

FromUserID extract userID from context.

func FromUserM

func FromUserM(ctx context.Context) *model.UserM

FromUserM extract *UserM from extract.

func NewAccessToken

func NewAccessToken(ctx context.Context, accessToken string) context.Context

NewAccessToken put accessToken into context.

func NewContext

func NewContext(ctx context.Context, info *jwt.RegisteredClaims) context.Context

NewContext put auth info into context.

func NewUserID

func NewUserID(ctx context.Context, userID string) context.Context

NewUserID put userID into context.

func NewUserM

func NewUserM(ctx context.Context, user *model.UserM) context.Context

NewUserM put *UserM into context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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