sessiondata

package
v0.0.0-...-f761163 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitRepositoryProvider

func InitRepositoryProvider(databaseProvider string)

InitRepositoryProvider - One time init for the given DB Provider

func NewPostgresSessionDataRepository

func NewPostgresSessionDataRepository(dcp *sql.DB) (interfaces.SessionDataStore, error)

NewPostgresSessionDataRepository will create a new instance of the SessionDataRepository

Types

type SessionDataRepository

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

SessionDataRepository is a RDB-backed Session Data repository

func (*SessionDataRepository) Cleanup

func (m *SessionDataRepository) Cleanup(interval time.Duration) (chan<- struct{}, <-chan struct{})

Cleanup runs a background goroutine every interval that deletes expired sessions from the database.

The design is based on https://github.com/yosssi/boltstore

func (*SessionDataRepository) DeleteValues

func (c *SessionDataRepository) DeleteValues(session, group string) error

DeleteValues deletes all values for the session and group

func (*SessionDataRepository) GetValues

func (c *SessionDataRepository) GetValues(session, group string) (map[string]string, error)

GetValues returns all values from the config table as a map

func (*SessionDataRepository) IsValidSession

func (c *SessionDataRepository) IsValidSession(session int) (bool, error)

IsValidSession - Determines if the given session ID is still valid (has not expired)

func (*SessionDataRepository) SetValues

func (c *SessionDataRepository) SetValues(session, group string, values map[string]string, autoExpire bool) error

SetValues replaces existing group values with those provided

func (*SessionDataRepository) StopCleanup

func (m *SessionDataRepository) StopCleanup(quit chan<- struct{}, done <-chan struct{})

StopCleanup stops the background cleanup from running.

Jump to

Keyboard shortcuts

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