gin_session

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 4 Imported by: 0

README

gin-session

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SessionCookieName = "SessionId"
View Source
var SessionExpireAge time.Duration = 604800 //seconds, default 7 days
View Source
var SessionKey = "Session"

Functions

func Middleware

func Middleware(store Store) gin.HandlerFunc

Types

type Session

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

func From

func From(ctx *gin.Context) *Session

func New

func New(key string, expire time.Duration, store Store) *Session

func (*Session) Clear

func (self *Session) Clear()

func (*Session) DefaultGet

func (self *Session) DefaultGet(key string, defaultValue interface{}) interface{}

func (*Session) Delete

func (self *Session) Delete(key string)

func (*Session) Get

func (self *Session) Get(key string) interface{}

func (*Session) GetExpireTime

func (self *Session) GetExpireTime() time.Time

func (*Session) Load

func (self *Session) Load() error

func (*Session) Refresh

func (self *Session) Refresh()

refresh key

func (*Session) Save

func (self *Session) Save() error

func (*Session) Set

func (self *Session) Set(key string, value interface{})

func (*Session) SetExpireAge

func (self *Session) SetExpireAge(expire time.Duration)

type Store

type Store interface {
	Get(key string) (map[string]interface{}, error)
	Set(key string, value map[string]interface{}, expire time.Duration) error
	Delete(key string)
	Exists(key string) bool
	GetExpireTime(key string) time.Time
	SetExpireTime(key string, duration time.Duration)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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