pgxstore

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 8 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 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