sessions

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: MPL-2.0-no-copyleft-exception Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	Key       string    `json:"key"`
	Values    string    `json:"values"`
	ExpiresOn time.Time `json:"expires_on"`
}

Session corresponds to the `sessions` table and encapsulates a web session.

type SessionManager

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

SessionManager manages many session objects.

func New

func New(datasvc *data.Client, options *sessions.Options, keyPairs ...[]byte) *SessionManager

New creates a new session tracker for the db layer connection provided.

func (*SessionManager) Get

func (sm *SessionManager) Get(r *http.Request, name string) (*sessions.Session, error)

Get gets the session for the given name

func (*SessionManager) LoadSession

func (sm *SessionManager) LoadSession(ctx context.Context, session *sessions.Session) error

LoadSession loads a session from the database.

func (*SessionManager) New

func (sm *SessionManager) New(r *http.Request, name string) (*sessions.Session, error)

New creates a new session for the given name

func (*SessionManager) Options

func (sm *SessionManager) Options(options sgin.Options)

Options sets the options for the session handler.

func (*SessionManager) Save

Save persists the session for the given name. Also requires the http writer.

func (*SessionManager) SaveSession

func (sm *SessionManager) SaveSession(s *sessions.Session) (string, error)

SaveSession saves the provided session with the codecs used.

Jump to

Keyboard shortcuts

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