postgres

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// DSN is the full Postgres connection string.
	DSN string
	// TableName allows overriding the default table used to store sessions.
	TableName string
	// MaxConnLifeTime configures the connection lifetime on the pool. Optional.
	MaxConnLifeTime time.Duration
	// MaxConns optionally caps the total connections in the pool.
	MaxConns int32
}

Config captures the configuration required to instantiate a Postgres backed session store.

type Store

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

Store implements the session Store interface backed by Postgres.

func New

func New(ctx context.Context, cfg Config) (*Store, error)

New constructs a new Postgres backed session store.

func (*Store) Close

func (s *Store) Close()

Close terminates the underlying connection pool.

func (*Store) DeleteSession

func (s *Store) DeleteSession(ctx context.Context, sessionID string, sessionType dto.SessionType) error

DeleteSession removes a session by identifier and type.

func (*Store) GetSession

func (s *Store) GetSession(ctx context.Context, sessionID string, sessionType dto.SessionType) (*dto.SessionRecord, error)

GetSession retrieves a session by identifier and type.

func (*Store) ListSessions

func (s *Store) ListSessions(ctx context.Context, opts store.ListSessionsOptions) ([]*dto.SessionRecord, int, error)

ListSessions returns paginated sessions filtered according to the provided options.

func (*Store) RenameSession

func (s *Store) RenameSession(ctx context.Context, sessionID string, sessionType dto.SessionType, sessionName string) (*dto.SessionRecord, error)

RenameSession updates the session name stored within the session_data JSON payload.

func (*Store) UpsertSession

func (s *Store) UpsertSession(ctx context.Context, record *dto.SessionRecord, preserveCreated bool) (*dto.SessionRecord, error)

UpsertSession inserts or updates a session record in the database.

Jump to

Keyboard shortcuts

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