session

package
v0.16.7 Latest Latest
Warning

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

Go to latest
Published: May 28, 2022 License: AGPL-3.0, AGPL-3.0-only Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Key = "sessionID"

Variables

View Source
var ErrExpired = errors.New("your session has been expired")
View Source
var ErrKeyConflict = errors.New("conflict key in database")

Functions

This section is empty.

Types

type Manager

type Manager interface {
	Create(ctx context.Context, a domain.Auth) (string, Session, error)
	Get(ctx context.Context, key string) (Session, error)
	Revoke(ctx context.Context, key string) error
	RevokeUser(ctx context.Context, id model.UIDType) error
}

func New

func New(c cache.Generic, repo Repo, log *zap.Logger) Manager

type Repo

type Repo interface {
	Create(ctx context.Context, key string, userID model.UIDType, regTime time.Time) (Session, error)
	Get(ctx context.Context, key string) (persistSession, error)
	RevokeUser(ctx context.Context, userID model.UIDType) (keys []string, err error)
	Revoke(ctx context.Context, key string) error
}

func NewMysqlRepo

func NewMysqlRepo(q *query.Query, logger *zap.Logger) Repo

type Session

type Session struct {
	RegTime   time.Time     `json:"reg_time"`
	UserID    model.UIDType `json:"user_id"`
	ExpiredAt int64         `json:"expired_at"`
}

Jump to

Keyboard shortcuts

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