Help us shape the future of Go! Take the 2026 Go Developer Survey

sessions

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2018 License: BSD-3-Clause Imports: 7 Imported by: 1

README

sesssions

Simple session manager for servers

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidSession indicates that there is no named session in the store
	// with the cookie value
	ErrInvalidSession = errors.New("invalid session")
	// ErrInvalidKey indicates there is no value in the underlying session that
	// matches the key.
	ErrInvalidKey = errors.New("invalid key")
)

Functions

This section is empty.

Types

type Manager

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

Manager creates and manages cookies

func NewManager

func NewManager(name string) *Manager

NewManager creates a safe to use Manager by initializing the map

func (*Manager) Get

func (m *Manager) Get(r *http.Request, key string) (string, error)

Get reads a cookie from a request, queries the session manager and returns the value if available. If the session is invalid ErrInvalidSession is returnted, if the key is invalid, ErrInvalidKey is returned.

func (*Manager) Set

func (m *Manager) Set(w http.ResponseWriter, r *http.Request, key, val string) error

Set creates a value in an underlying session if it exists. If it doesn't, a new session is created.

func (*Manager) StartExpunge

func (m *Manager) StartExpunge()

func (*Manager) StopExpunge

func (m *Manager) StopExpunge()

Jump to

Keyboard shortcuts

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