sessionstore

package
v0.0.0-...-ae8612d Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoUid = status.Errorf(codes.InvalidArgument, "uid is required")

Functions

This section is empty.

Types

type GetOption

type GetOption func(*getOptions)

func WithSids

func WithSids(sids []string) GetOption

type Session

type Session struct {
	Sid      string // session_id
	Uid      string // user_id
	Bid      string // boat_id
	Platform string
}

func (*Session) Valid

func (sess *Session) Valid() bool

type SessionSlice

type SessionSlice []Session

func (SessionSlice) Len

func (p SessionSlice) Len() int

func (SessionSlice) Less

func (p SessionSlice) Less(i, j int) bool

func (SessionSlice) Swap

func (p SessionSlice) Swap(i, j int)

type Store

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

func NewStore

func NewStore(
	logger *logrus.Logger,
	redisPool *redis.Pool,
) *Store

func (*Store) DeleteSessions

func (ss *Store) DeleteSessions(ctx context.Context, uid string, sids []string) error

func (*Store) GetPlatformToSessions

func (ss *Store) GetPlatformToSessions(ctx context.Context, uid string, opts ...GetOption) (map[string][]Session, error)

获取session信息,map 形式 PlatformToSessions

func (*Store) GetSessions

func (ss *Store) GetSessions(ctx context.Context, uid string, opts ...GetOption) ([]Session, error)

获取session信息

func (*Store) GetSidToSession

func (ss *Store) GetSidToSession(ctx context.Context, uid string, opts ...GetOption) (map[string]Session, error)

获取session信息,map 形式 SidToSession

func (*Store) SetSession

func (ss *Store) SetSession(ctx context.Context, sess Session) error

Jump to

Keyboard shortcuts

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