Documentation ¶
Index ¶
- type Repository
- func (r *Repository) Dislike(ctx context.Context, role babynames.Role, name string) (int, error)
- func (r *Repository) GetAndAcknowledgeUnseenMatch(ctx context.Context, role babynames.Role) (string, error)
- func (r *Repository) GetDislikedNames(ctx context.Context, role babynames.Role) ([]babynames.DislikedName, error)
- func (r *Repository) GetLikedNames(ctx context.Context, role babynames.Role) ([]babynames.LikedName, error)
- func (r *Repository) GetMatches(ctx context.Context, role babynames.Role) ([]babynames.Match, error)
- func (r *Repository) GetNextName(ctx context.Context, role babynames.Role) (string, int, error)
- func (r *Repository) GetPendingSuperlike(ctx context.Context, role babynames.Role) (string, error)
- func (r *Repository) GetStats(ctx context.Context, role babynames.Role) (babynames.Stats, error)
- func (r *Repository) ImportNames(ctx context.Context, names []string) error
- func (r *Repository) Like(ctx context.Context, role babynames.Role, name string) error
- func (r *Repository) Superlike(ctx context.Context, role babynames.Role, name string) error
- func (r *Repository) UndoDislike(ctx context.Context, role babynames.Role, name string) error
- func (r *Repository) UndoLike(ctx context.Context, role babynames.Role, name string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository encapsulates all PostgreSQL storage mechanics.
func NewRepository ¶
func NewRepository(connstr string) *Repository
NewRepository creates a new PostgreSQL repository.
func (*Repository) Dislike ¶
Dislike flags a name as disliked for the specified role, returning the number of times the role has disliked the name.
func (*Repository) GetAndAcknowledgeUnseenMatch ¶
func (r *Repository) GetAndAcknowledgeUnseenMatch(ctx context.Context, role babynames.Role) (string, error)
GetAndAcknowledgeUnseenMatch returns a matched name between both roles that the specified role has not yet seen. This function will flag the name as seen in the process.
func (*Repository) GetDislikedNames ¶
func (r *Repository) GetDislikedNames(ctx context.Context, role babynames.Role) ([]babynames.DislikedName, error)
GetDislikedNames gets a list of all disliked names by the role.
func (*Repository) GetLikedNames ¶
func (r *Repository) GetLikedNames(ctx context.Context, role babynames.Role) ([]babynames.LikedName, error)
GetLikedNames gets a list of all liked names by the role.
func (*Repository) GetMatches ¶
func (r *Repository) GetMatches(ctx context.Context, role babynames.Role) ([]babynames.Match, error)
GetMatches gets a list of all names that are matched with the other role.
func (*Repository) GetNextName ¶
GetNextName gets the next name in the queue for the role.
func (*Repository) GetPendingSuperlike ¶
func (r *Repository) GetPendingSuperlike(ctx context.Context, role babynames.Role) (string, error)
GetPendingSuperlike gets any pending superlikes that requires the role's attention.
func (*Repository) GetStats ¶
func (r *Repository) GetStats(ctx context.Context, role babynames.Role) (babynames.Stats, error)
GetStats retrieves the progression stats of a role.
func (*Repository) ImportNames ¶
func (r *Repository) ImportNames(ctx context.Context, names []string) error
ImportNames imports a set of names to the database if they don't exist already.
func (*Repository) Like ¶
func (r *Repository) Like(ctx context.Context, role babynames.Role, name string) error
Like flags a name as liked for the specified role.
func (*Repository) Superlike ¶
func (r *Repository) Superlike(ctx context.Context, role babynames.Role, name string) error
Superlike flags a name as super-liked for the specified role.
func (*Repository) UndoDislike ¶
func (r *Repository) UndoDislike(ctx context.Context, role babynames.Role, name string) error
UndoDislike removes a dislike for a name.