session

package
Version: v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultKey = "github.com/LonelyPale/goutils/session"
)

Variables

This section is empty.

Functions

func GenToken

func GenToken(id string)

func Sessions

func Sessions(store Store) gin.HandlerFunc

Types

type MemoryStore

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

func (*MemoryStore) Delete

func (m *MemoryStore) Delete(id string) error

func (*MemoryStore) Get

func (m *MemoryStore) Get(id string) (Session, error)

func (*MemoryStore) New

func (m *MemoryStore) New() Session

func (*MemoryStore) Save

func (m *MemoryStore) Save(s Session) error

func (*MemoryStore) Session

func (m *MemoryStore) Session(request interface{}) (Session, error)

type Session

type Session interface {
	ID() string
	Get(key interface{}) interface{}
	Set(key, value interface{})
	Delete(key interface{})
	Save() error
}

func Default

func Default(c *gin.Context) Session

func NewSession

func NewSession(store Store, ids ...string) Session

type Store

type Store interface {
	New() Session
	Get(id string) (Session, error)
	Delete(id string) error
	Save(s Session) error
}

func NewMemoryStore

func NewMemoryStore() (Store, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto