contextx

package
v0.2.0-alpha.12 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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