pgxstore

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	Table string

	// Used for testing
	Now func() time.Time
	// contains filtered or unexported fields
}

func New

func New(db *pgxpool.Pool) *Store

func (*Store) Cleanup

func (s *Store) Cleanup(ctx context.Context) error

Cleanup removes expired sessions from the store.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, id string) error

func (*Store) Find

func (s *Store) Find(ctx context.Context, id string) (data []byte, expiry time.Time, err error)

Find returns the data for a session id from the store. If the session is not found, expired or tampered, the data will be nil and the time will be zero, but there will be no error.

func (*Store) Migrate

func (s *Store) Migrate(ctx context.Context) error

func (*Store) Reset

func (s *Store) Reset(ctx context.Context) error

Reset removes all sessions from the store.

func (*Store) Upsert

func (s *Store) Upsert(ctx context.Context, id string, data []byte, expiry time.Time) error

Jump to

Keyboard shortcuts

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