session

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Valid time.Duration
}

Config struct

type Listener

type Listener struct {
	// Created Listener
	Created sessionListener
	// Destroyed Listener
	Destroyed sessionListener
	// Invalidated Listener
	Invalidated sessionListener
	// Refreshed Listener
	Refreshed sessionListener
}

Listener struct

type Provider

type Provider interface {
	// CookieName session cookie name
	CookieName() string
	// Exists session
	Exists(id string) bool
	// GetId session id
	GetId(r *http.Request) string
	// Del session
	Del(id string)
	// Get session id
	Get(id string) Session
	// GetAll session
	GetAll() map[string]Session
	// Clear sessions
	Clear()
	// New return session
	New(config *Config, listener *Listener) Session
	// Refresh session
	Refresh(session Session, config *Config, listener *Listener)
	// Clean session
	Clean(config *Config, listener *Listener)
}

Provider interface

type Session

type Session interface {
	// Id session id
	Id() string
	// Renew session
	Renew(lifeTime time.Duration)
	// Invalidate session
	Invalidate()
	// Invalidated session
	Invalidated() bool
	// Get named val
	Get(name string) interface{}
	// GetAll session's values
	GetAll() map[string]interface{}
	// Set named val
	Set(name string, val interface{})
	// SetAll values
	SetAll(data map[string]interface{}, flush bool)
	// Del named val
	Del(name string)
	// Clear session's val
	Clear()
}

Session interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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