contexti

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPool

func GetPool[REQ any]() sync.Pool

Types

type AuthInfo

type AuthInfo interface {
	IdStr() string
}

type AuthInterface

type AuthInterface interface {
	Validate() error
	GenerateToken(secret []byte) (string, error)
	ParseToken(token string, secret []byte) error
}

type Authorization

type Authorization struct {
	AuthInfo `json:"auth"`
	jwt.RegisteredClaims
	AuthInfoRaw string `json:"-"`
}

func (*Authorization) GenerateToken

func (x *Authorization) GenerateToken(secret []byte) (string, error)

func (*Authorization) ParseToken

func (x *Authorization) ParseToken(token string, secret []byte) error

func (*Authorization) Validate

func (x *Authorization) Validate() error

type Context

type Context[REQ any] struct {
	LastActiveAt int64
	*Authorization
	*contexti.RequestContext[REQ]
}

func CtxFromContext

func CtxFromContext[REQ any](ctx context.Context) *Context[REQ]

func (*Context[REQ]) ContextWrapper

func (ctxi *Context[REQ]) ContextWrapper() context.Context

func (*Context[REQ]) StartSpan

func (c *Context[REQ]) StartSpan(name string, o ...trace.StartOption) (*Context[REQ], *trace.Span)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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