Documentation ¶
Index ¶
- Variables
- type Cache
- type CallbackData
- type CallbacksRepository
- type Client
- type PostgreSQLRepository
- func (r *PostgreSQLRepository) AddToLearningBatch(ctx context.Context, chatID int64, word string) error
- func (r *PostgreSQLRepository) AddWordTranslation(ctx context.Context, chatID int64, word, translation string) error
- func (r *PostgreSQLRepository) DeleteFromLearningBatchGtGuessedStreak(ctx context.Context, chatID int64, guessedStreakLimit int) (int, error)
- func (r *PostgreSQLRepository) FindCallback(ctx context.Context, chatID int64, uuid string) (*CallbackData, error)
- func (r *PostgreSQLRepository) FindRandomBatchedWordTranslation(ctx context.Context, chatID int64) (*WordTranslation, error)
- func (r *PostgreSQLRepository) FindRandomNotBatchedWordTranslation(ctx context.Context, chatID int64, streakLimit int) (*WordTranslation, error)
- func (r *PostgreSQLRepository) FindWordTranslation(ctx context.Context, chatID int64, word string) (*WordTranslation, error)
- func (r *PostgreSQLRepository) FindWordsToReview(ctx context.Context, chatID int64) ([]WordTranslation, error)
- func (r *PostgreSQLRepository) GetBatchedWordTranslationsCount(ctx context.Context, chatID int64) (int, error)
- func (r *PostgreSQLRepository) GetStats(ctx context.Context, chatID int64) (*WordTranslationStats, error)
- func (r *PostgreSQLRepository) IncreaseGuessedStreak(ctx context.Context, chatID int64, word string) error
- func (r *PostgreSQLRepository) InsertCallback(ctx context.Context, data CallbackData) (string, error)
- func (r *PostgreSQLRepository) MarkToReviewAndResetStreak(ctx context.Context, chatID int64, word string) error
- func (r *PostgreSQLRepository) ResetGuessedStreak(ctx context.Context, chatID int64, word string) error
- func (r *PostgreSQLRepository) ResetToReview(ctx context.Context, chatID int64) error
- func (r *PostgreSQLRepository) Transact(ctx context.Context, txFunc func(r Repository) error) error
- type Repository
- type WordTranslation
- type WordTranslationStats
- type WordTranslationsRepository
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
This section is empty.
Types ¶
type CallbackData ¶
type CallbacksRepository ¶
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 PostgreSQLRepository ¶
type PostgreSQLRepository struct {
// contains filtered or unexported fields
}
func NewPostgreSQLRepository ¶
func (*PostgreSQLRepository) AddToLearningBatch ¶
func (*PostgreSQLRepository) AddWordTranslation ¶
func (*PostgreSQLRepository) DeleteFromLearningBatchGtGuessedStreak ¶
func (*PostgreSQLRepository) FindCallback ¶
func (r *PostgreSQLRepository) FindCallback(ctx context.Context, chatID int64, uuid string) (*CallbackData, error)
func (*PostgreSQLRepository) FindRandomBatchedWordTranslation ¶
func (r *PostgreSQLRepository) FindRandomBatchedWordTranslation(ctx context.Context, chatID int64) (*WordTranslation, error)
func (*PostgreSQLRepository) FindRandomNotBatchedWordTranslation ¶
func (r *PostgreSQLRepository) FindRandomNotBatchedWordTranslation(ctx context.Context, chatID int64, streakLimit int) (*WordTranslation, error)
func (*PostgreSQLRepository) FindWordTranslation ¶
func (r *PostgreSQLRepository) FindWordTranslation(ctx context.Context, chatID int64, word string) (*WordTranslation, error)
func (*PostgreSQLRepository) FindWordsToReview ¶
func (r *PostgreSQLRepository) FindWordsToReview(ctx context.Context, chatID int64) ([]WordTranslation, error)
func (*PostgreSQLRepository) GetBatchedWordTranslationsCount ¶
func (*PostgreSQLRepository) GetStats ¶
func (r *PostgreSQLRepository) GetStats(ctx context.Context, chatID int64) (*WordTranslationStats, error)
func (*PostgreSQLRepository) IncreaseGuessedStreak ¶
func (*PostgreSQLRepository) InsertCallback ¶
func (r *PostgreSQLRepository) InsertCallback(ctx context.Context, data CallbackData) (string, error)
func (*PostgreSQLRepository) MarkToReviewAndResetStreak ¶
func (*PostgreSQLRepository) ResetGuessedStreak ¶
func (*PostgreSQLRepository) ResetToReview ¶
func (r *PostgreSQLRepository) ResetToReview(ctx context.Context, chatID int64) error
func (*PostgreSQLRepository) Transact ¶
func (r *PostgreSQLRepository) Transact(ctx context.Context, txFunc func(r Repository) error) error
type Repository ¶
type Repository interface { Transact(ctx context.Context, txFunc func(r Repository) error) error WordTranslationsRepository CallbacksRepository }
type WordTranslation ¶
type WordTranslationStats ¶
type WordTranslationsRepository ¶
type WordTranslationsRepository interface { GetStats(ctx context.Context, chatID int64) (*WordTranslationStats, error) AddWordTranslation(ctx context.Context, chatID int64, word, translation string) error AddToLearningBatch(ctx context.Context, chatID int64, word string) error GetBatchedWordTranslationsCount(ctx context.Context, chatID int64) (int, error) FindWordTranslation(ctx context.Context, chatID int64, word string) (*WordTranslation, error) FindRandomBatchedWordTranslation(ctx context.Context, chatID int64) (*WordTranslation, error) FindRandomNotBatchedWordTranslation(ctx context.Context, chatID int64, streakLimit int) (*WordTranslation, error) FindWordsToReview(ctx context.Context, chatID int64) ([]WordTranslation, error) IncreaseGuessedStreak(ctx context.Context, chatID int64, word string) error ResetGuessedStreak(ctx context.Context, chatID int64, word string) error ResetToReview(ctx context.Context, chatID int64) error MarkToReviewAndResetStreak(ctx context.Context, chatID int64, word string) error DeleteFromLearningBatchGtGuessedStreak(ctx context.Context, chatID int64, guessedStreakLimit int) (int, error) }
Click to show internal directories.
Click to hide internal directories.