pgstore

package
v0.0.0-...-3f13264 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package pgstore implements a Postgres-backed session store for alexedwards/scs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store implements the CtxStore interface provided by scs.

func New

func New(db *sql.DB) *Store

New creates a new Store.

func NewWithCleanupInterval

func NewWithCleanupInterval(db *sql.DB, interval time.Duration) *Store

NewWithCleanupInterval creates a new Store with the given cleanup interval.

func (*Store) Commit

func (p *Store) Commit(token string, b []byte, expiry time.Time) error

Commit adds a session to the database.

func (*Store) CommitCtx

func (p *Store) CommitCtx(ctx context.Context, token string, b []byte, expiry time.Time) error

Commit adds a session to the database.

func (*Store) Delete

func (p *Store) Delete(token string) error

Delete removes a session from the database.

func (*Store) DeleteCtx

func (p *Store) DeleteCtx(ctx context.Context, token string) error

Delete removes a session from the database.

func (*Store) Find

func (p *Store) Find(token string) ([]byte, bool, error)

Find queries the database for an unexpired session.

func (*Store) FindCtx

func (p *Store) FindCtx(ctx context.Context, token string) ([]byte, bool, error)

FindCtx queries the database for an unexpired session.

func (*Store) Start

func (p *Store) Start(ctx context.Context)

Start tells the Store to begin cleaning up expired sessions. The Store will stop cleaning up when the given context is cancelled.

Jump to

Keyboard shortcuts

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