Help us shape the future of Go! Take the 2026 Go Developer Survey

sessions

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Provides = wire.NewSet(
	wire.Struct(new(Controller), "*"),
	wire.Struct(new(Service), "*"),
)

Functions

This section is empty.

Types

type Controller

type Controller struct {
	SessionsService *Service
}

func (*Controller) Clear

func (x *Controller) Clear(ctx context.Context, c *app.RequestContext)

Clear 清除所有会话 @router /sessions [DELETE]

func (*Controller) Lists

func (x *Controller) Lists(ctx context.Context, c *app.RequestContext)

Lists 列出所有会话用户 ID @router /sessions [GET]

func (*Controller) Remove

func (x *Controller) Remove(ctx context.Context, c *app.RequestContext)

Remove 移除会话 @router /sessions/:uid [DELETE]

type Option

type Option func(x *Sessions)

func SetDynamicValues

func SetDynamicValues(v *kv.DynamicValues) Option

func SetNamespace

func SetNamespace(v string) Option

func SetRedis

func SetRedis(v *redis.Client) Option

type Service

type Service struct {
	*Sessions
}

func (*Service) Clear

func (x *Service) Clear(ctx context.Context) (err error)

Clear 清除所有会话

func (*Service) Key

func (x *Service) Key(name string) string

func (*Service) Lists

func (x *Service) Lists(ctx context.Context) (data []string, err error)

Lists 列出所有会话用户 ID

func (*Service) Remove

func (x *Service) Remove(ctx context.Context, name string) error

Remove 移除会话

func (*Service) Renew

func (x *Service) Renew(ctx context.Context, userId string) error

Renew 续约会话

func (*Service) Scan

func (x *Service) Scan(ctx context.Context, cursor uint64) ([]string, uint64, error)

func (*Service) Set

func (x *Service) Set(ctx context.Context, name string, jti string) error

Set 设置会话

func (*Service) Verify

func (x *Service) Verify(ctx context.Context, name string, jti string) (result bool, err error)

Verify 验证会话一致性

type Sessions

type Sessions struct {
	Namespace     string
	Redis         *redis.Client
	DynamicValues *kv.DynamicValues
}

func New

func New(options ...Option) *Sessions

Jump to

Keyboard shortcuts

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