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: 0

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