postgres

package
v0.0.0-...-07c978c Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRepository

func NewRepository(dsn string) (domain.Repository, error)

Types

type Repository

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

func (*Repository) CreatePoll

func (r *Repository) CreatePoll(ctx context.Context, poll *domain.Poll, options []string, tags []string) error

func (*Repository) CreateSkip

func (r *Repository) CreateSkip(ctx context.Context, pollID, userID uuid.UUID) error

func (*Repository) CreateUser

func (r *Repository) CreateUser(ctx context.Context, user *domain.User) error

func (*Repository) CreateVote

func (r *Repository) CreateVote(ctx context.Context, pollID, userID, optionID uuid.UUID) error

func (*Repository) DeleteUser

func (r *Repository) DeleteUser(ctx context.Context, id uuid.UUID) error

func (*Repository) DeleteVote

func (r *Repository) DeleteVote(ctx context.Context, voteID, userID uuid.UUID) error

func (*Repository) GetCachedPoll

func (r *Repository) GetCachedPoll(ctx context.Context, id uuid.UUID) (*domain.Poll, error)

func (*Repository) GetCachedPollStats

func (r *Repository) GetCachedPollStats(ctx context.Context, pollID uuid.UUID) (*domain.PollStats, error)

func (*Repository) GetPollByID

func (r *Repository) GetPollByID(ctx context.Context, id uuid.UUID) (*domain.Poll, error)

func (*Repository) GetPollStats

func (r *Repository) GetPollStats(ctx context.Context, pollID uuid.UUID) (*domain.PollStats, error)

func (*Repository) GetPollsForFeed

func (r *Repository) GetPollsForFeed(ctx context.Context, userID uuid.UUID, tag string, page, limit int) ([]domain.Poll, int, error)

func (*Repository) GetUserByEmail

func (r *Repository) GetUserByEmail(ctx context.Context, email string) (*domain.User, error)

func (*Repository) GetUserByID

func (r *Repository) GetUserByID(ctx context.Context, id uuid.UUID) (*domain.User, error)

func (*Repository) GetUserDailyVoteCount

func (r *Repository) GetUserDailyVoteCount(ctx context.Context, userID uuid.UUID, date time.Time) (int, error)

func (*Repository) GetUserVotes

func (r *Repository) GetUserVotes(ctx context.Context, userID uuid.UUID, page, limit int) ([]domain.Vote, int, error)

func (*Repository) GetVoteByID

func (r *Repository) GetVoteByID(ctx context.Context, voteID uuid.UUID) (*domain.Vote, error)

func (*Repository) HasSkipped

func (r *Repository) HasSkipped(ctx context.Context, pollID, userID uuid.UUID) (bool, error)

func (*Repository) HasVoted

func (r *Repository) HasVoted(ctx context.Context, pollID, userID uuid.UUID) (bool, error)

func (*Repository) IncrementUserDailyVoteCount

func (r *Repository) IncrementUserDailyVoteCount(ctx context.Context, userID uuid.UUID, date time.Time) error

func (*Repository) InvalidatePollStatsCache

func (r *Repository) InvalidatePollStatsCache(ctx context.Context, pollID uuid.UUID) error

func (*Repository) SetCachedPoll

func (r *Repository) SetCachedPoll(ctx context.Context, poll *domain.Poll) error

func (*Repository) SetCachedPollStats

func (r *Repository) SetCachedPollStats(ctx context.Context, pollID uuid.UUID, stats *domain.PollStats) error

func (*Repository) UpdateUser

func (r *Repository) UpdateUser(ctx context.Context, user *domain.User) error

func (*Repository) UpdateVote

func (r *Repository) UpdateVote(ctx context.Context, voteID, userID, optionID uuid.UUID) error

func (*Repository) WithTransaction

func (r *Repository) WithTransaction(ctx context.Context, fn func(ctx context.Context) error) error

Jump to

Keyboard shortcuts

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