postgres

package
v0.0.0-...-8956ad9 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Begin(ctx context.Context) (pgx.Tx, error)
	Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error)
	QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
	Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
}

type Repository

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

func NewRepository

func NewRepository(ctx context.Context, client Client, log *slog.Logger) *Repository

func (*Repository) AddToLearningBatch

func (r *Repository) AddToLearningBatch(ctx context.Context, chatID int64, word string) error

func (*Repository) AddWordTranslation

func (r *Repository) AddWordTranslation(ctx context.Context, chatID int64, word, translation, description string) error

func (*Repository) ConfirmAuthConfirmation

func (r *Repository) ConfirmAuthConfirmation(ctx context.Context, chatID int64, token string) error

func (*Repository) DeleteAuthConfirmation

func (r *Repository) DeleteAuthConfirmation(ctx context.Context, chatID int64, token string) error

func (*Repository) DeleteFromLearningBatchGtGuessedStreak

func (r *Repository) DeleteFromLearningBatchGtGuessedStreak(ctx context.Context, chatID int64, guessedStreakLimit int) (int, error)

func (*Repository) DeleteWordTranslation

func (r *Repository) DeleteWordTranslation(ctx context.Context, chatID int64, word string) error

func (*Repository) FindCallback

func (r *Repository) FindCallback(ctx context.Context, chatID int64, uuid string) (*dal.CallbackData, error)

func (*Repository) FindRandomWordTranslation

func (r *Repository) FindRandomWordTranslation(ctx context.Context, chatID int64, filter dal.FindRandomWordFilter) (*dal.WordTranslation, error)

func (*Repository) FindWordTranslation

func (r *Repository) FindWordTranslation(ctx context.Context, chatID int64, word string) (*dal.WordTranslation, error)

func (*Repository) FindWordTranslations

func (r *Repository) FindWordTranslations(ctx context.Context, chatID int64, filter dal.WordTranslationsFilter) ([]dal.WordTranslation, int, error)

func (*Repository) GetBatchedWordTranslationsCount

func (r *Repository) GetBatchedWordTranslationsCount(ctx context.Context, chatID int64) (int, error)

func (*Repository) GetStats

func (r *Repository) GetStats(ctx context.Context, chatID int64, date time.Time) (*dal.Stats, error)

func (*Repository) GetStatsRange

func (r *Repository) GetStatsRange(ctx context.Context, chatID int64, from, to time.Time) ([]dal.Stats, error)

func (*Repository) GetTotalStats

func (r *Repository) GetTotalStats(ctx context.Context, chatID int64) (*dal.TotalStats, error)

func (*Repository) IncreaseGuessedStreak

func (r *Repository) IncreaseGuessedStreak(ctx context.Context, chatID int64, word string) error

func (*Repository) IncrementWordGuessed

func (r *Repository) IncrementWordGuessed(ctx context.Context, chatID int64) error

func (*Repository) IncrementWordMissed

func (r *Repository) IncrementWordMissed(ctx context.Context, chatID int64) error

func (*Repository) InsertAuthConfirmation

func (r *Repository) InsertAuthConfirmation(ctx context.Context, chatID int64, token string, expiresIn time.Duration) error

func (*Repository) InsertCallback

func (r *Repository) InsertCallback(ctx context.Context, data dal.CallbackData) (string, error)

func (*Repository) IsConfirmed

func (r *Repository) IsConfirmed(ctx context.Context, chatID int64, token string) (bool, error)

func (*Repository) MarkToReview

func (r *Repository) MarkToReview(ctx context.Context, chatID int64, word string, toReview bool) error

func (*Repository) ResetGuessedStreak

func (r *Repository) ResetGuessedStreak(ctx context.Context, chatID int64, word string) error

func (*Repository) ResetToReview

func (r *Repository) ResetToReview(ctx context.Context, chatID int64) error

func (*Repository) Transact

func (r *Repository) Transact(ctx context.Context, txFunc func(r dal.Repository) error) error

func (*Repository) UpdateTotalWordsLearned

func (r *Repository) UpdateTotalWordsLearned(ctx context.Context, chatID int64) error

func (*Repository) UpdateWordTranslation

func (r *Repository) UpdateWordTranslation(ctx context.Context, chatID int64, word, updatedWord, updatedTranslation, description string) error

Jump to

Keyboard shortcuts

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