session

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Extend added in v0.3.0

func Extend(driver string, handler Handler)

Types

type Config

type Config struct {
	//Default Session Driver
	Driver string

	CookieName string

	//Session Lifetime
	Lifetime time.Duration

	//Session Encryption
	Encrypt bool

	//Session File Location
	Files string
}

type CookieHandler

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

func NewCookieHandler

func NewCookieHandler() *CookieHandler

func (*CookieHandler) Read

func (c *CookieHandler) Read(id string) string

func (*CookieHandler) SetRequest

func (c *CookieHandler) SetRequest(req Request)

func (*CookieHandler) SetResponse

func (c *CookieHandler) SetResponse(res Response)

func (*CookieHandler) Write

func (c *CookieHandler) Write(id string, data string)

type FileHandler

type FileHandler struct {
	Path     string
	Lifetime time.Duration
}

func (*FileHandler) Read

func (c *FileHandler) Read(id string) string

func (*FileHandler) Write

func (c *FileHandler) Write(id string, data string)

type Handler

type Handler interface {
	Read(id string) string
	Write(id string, data string)
}

type Manager

type Manager struct {
	Config *Config
	// contains filtered or unexported fields
}

func NewManager

func NewManager(config *Config) *Manager

func (*Manager) SessionSave

func (m *Manager) SessionSave(res Response) *Store

func (*Manager) SessionStart

func (m *Manager) SessionStart(req Request) *Store

type RedisHandler added in v0.3.0

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

func NewRedisHandler added in v0.3.0

func NewRedisHandler(pool *redis.Pool, prefix string, lifetime time.Duration) *RedisHandler

NewRedisHandler Create a redis session handler

func (*RedisHandler) Read added in v0.3.0

func (rh *RedisHandler) Read(id string) string

func (*RedisHandler) Write added in v0.3.0

func (rh *RedisHandler) Write(id string, data string)

type Request

type Request interface {
	Cookie(key string, value ...string) (string, error)
}

type Response

type Response interface {
	Cookie(name interface{}, params ...interface{}) error
}

type Store

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

func NewStore

func NewStore(name string, handler Handler) *Store

func (*Store) All

func (s *Store) All() map[string]interface{}

func (*Store) Clear

func (s *Store) Clear()

func (*Store) Forget

func (s *Store) Forget(names ...string)

func (*Store) Get

func (s *Store) Get(name string, value ...interface{}) interface{}

func (*Store) GetHandler

func (s *Store) GetHandler() Handler

func (*Store) GetId

func (s *Store) GetId() string

func (*Store) GetName

func (s *Store) GetName() string

func (*Store) Remove

func (s *Store) Remove(name string) interface{}

func (*Store) Save

func (s *Store) Save()

func (*Store) Set

func (s *Store) Set(name string, value interface{})

func (*Store) SetId

func (s *Store) SetId(id string)

func (*Store) Start

func (s *Store) Start()

Jump to

Keyboard shortcuts

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