postgresql

package
v0.0.0-...-29719d2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package postgresql provides an implementation of the storage service using PostgreSQL. It relies on the generated sqlc queries.

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("postgresql",
	fx.Decorate(func(slog *slog.Logger) *slog.Logger {
		return slog.With("module", "postgresql")
	}),
	fx.Provide(
		NewStorage,
		(*Storage).userStorage,
		(*Storage).userSessionStorage,
		(*Storage).notificationUserStorage,
		(*Storage).dosageStorage,
		(*Storage).doseHistoryStorage,
	),
)

Functions

This section is empty.

Types

type Storage

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

Storage is the PostgreSQL-backed storage.

func NewStorage

func NewStorage(lc fx.Lifecycle, config e2clickermodule.PostgreSQL, logger *slog.Logger) (*Storage, error)

NewStorage creates a new PostgreSQL-backed storage.

func (*Storage) CreateUser

func (s *Storage) CreateUser(ctx context.Context, userSecret user.Secret, name string) (user.User, error)

func (*Storage) DeleteSession

func (s *Storage) DeleteSession(ctx context.Context, userSecret user.Secret, sessionID int64) error

func (*Storage) ListSessions

func (s *Storage) ListSessions(ctx context.Context, userSecret user.Secret) ([]user.Session, error)

func (*Storage) RegisterSession

func (s *Storage) RegisterSession(ctx context.Context, token []byte, userSecret user.Secret, userAgent string) error

func (*Storage) UpdateUserLocale

func (s *Storage) UpdateUserLocale(ctx context.Context, userSecret user.Secret, locale user.Locale) error

func (*Storage) UpdateUserName

func (s *Storage) UpdateUserName(ctx context.Context, userSecret user.Secret, name string) error

func (*Storage) User

func (s *Storage) User(ctx context.Context, userSecret user.Secret) (user.User, error)

func (*Storage) ValidateSession

func (s *Storage) ValidateSession(ctx context.Context, token []byte) (user.Session, error)

Jump to

Keyboard shortcuts

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