adapter

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

@Time : 2019-07-12 16:42 @Author : zr

@Time : 2019-07-12 16:34 @Author : zr

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	//首次插入session, 创建key为token的map
	CreateTokenMap(userId string, token string, channel string, expireAt time.Time) error

	//更新
	SessionUpdate(*model.Session) error

	//通过token查找session
	FindByToken(token string) (*model.Session, error)

	//通过UserId找到所有token
	FindAllSessionsByUserId(id string) (sessions []*model.Session, err error)

	//根据token删除session
	DeleteByToken(token string) error
}

type Redis

type Redis struct {
	// contains filtered or unexported fields
}

func NewRedis

func NewRedis(options *redis.UniversalOptions, prefix string) Redis

func (Redis) CreateTokenMap

func (r Redis) CreateTokenMap(userId string, token string, channel string, expireAt time.Time) error

func (Redis) DeleteByToken

func (r Redis) DeleteByToken(token string) error

func (Redis) FindAllSessionsByUserId added in v1.0.3

func (r Redis) FindAllSessionsByUserId(id string) (sessions []*model.Session, err error)

func (Redis) FindByToken

func (r Redis) FindByToken(token string) (*model.Session, error)

func (Redis) SessionUpdate

func (r Redis) SessionUpdate(s *model.Session) error

func (Redis) TokenMapTokenExpireAt

func (r Redis) TokenMapTokenExpireAt(token string, expireAt time.Time) error

Jump to

Keyboard shortcuts

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