Documentation
¶
Index ¶
- type EntgoRepository
- func (r *EntgoRepository) CreateChallenge(ctx context.Context, ch *domain.Challenge) (*domain.Challenge, error)
- func (r *EntgoRepository) CreateOrUpdateBadgeByType(ctx context.Context, b *domain.Badge) (*domain.Badge, error)
- func (r *EntgoRepository) CreateOrUpdateChallengeByContent(ctx context.Context, ch *domain.Challenge) (*domain.Challenge, error)
- func (r *EntgoRepository) CreateOrUpdateUserSession(ctx context.Context, s *domain.UserSession) (*domain.UserSession, error)
- func (r *EntgoRepository) CreatePrediction(ctx context.Context, pred *domain.Prediction) (*domain.Prediction, error)
- func (r *EntgoRepository) CreateUser(ctx context.Context, u *domain.User) (*domain.User, error)
- func (r *EntgoRepository) CreateUserSession(ctx context.Context, s *domain.UserSession) (*domain.UserSession, error)
- func (r *EntgoRepository) FilterChallenges(ctx context.Context, args *domain.FilterChallengesArgs) ([]*domain.Challenge, int, error)
- func (r *EntgoRepository) FilterUserChallenges(ctx context.Context, args *domain.FilterChallengesArgs) ([]*domain.Challenge, int, error)
- func (r *EntgoRepository) GetChallengeByContent(ctx context.Context, content string) (*domain.Challenge, error)
- func (r *EntgoRepository) GetChallengeByID(ctx context.Context, id uuid.UUID, userID uuid.UUID) (*domain.Challenge, error)
- func (r *EntgoRepository) GetChallengeCount(ctx context.Context) (int, error)
- func (r *EntgoRepository) GetChallengesByAuthor(ctx context.Context, authorID uuid.UUID, limit, offset int) ([]*domain.Challenge, int, error)
- func (r *EntgoRepository) GetClosingChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)
- func (r *EntgoRepository) GetFinishedChallengeCount(ctx context.Context) (int, error)
- func (r *EntgoRepository) GetOngoingChallengeCount(ctx context.Context) (int, error)
- func (r *EntgoRepository) GetPopularFinishedChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)
- func (r *EntgoRepository) GetPopularOngoingChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)
- func (r *EntgoRepository) GetPredictionByUserAndChallenge(ctx context.Context, userID, challengeID uuid.UUID) (*domain.Prediction, error)
- func (r *EntgoRepository) GetPredictionCount(ctx context.Context) (int, error)
- func (r *EntgoRepository) GetRandomFalseChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)
- func (r *EntgoRepository) GetRandomFinishedChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)
- func (r *EntgoRepository) GetRandomOngoingChallenges(ctx context.Context, limit int, userID uuid.UUID) ([]*domain.Challenge, error)
- func (r *EntgoRepository) GetRandomPendingChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)
- func (r *EntgoRepository) GetRandomTrueChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)
- func (r *EntgoRepository) GetUserByEmail(ctx context.Context, email string) (*domain.User, error)
- func (r *EntgoRepository) GetUserByID(ctx context.Context, id uuid.UUID) (*domain.User, error)
- func (r *EntgoRepository) GetUserBySession(ctx context.Context, s *domain.UserSession) (*domain.User, error)
- func (r *EntgoRepository) GetUserCount(ctx context.Context) (int, error)
- func (r *EntgoRepository) GetUserSummary(ctx context.Context, userID uuid.UUID) (*domain.UserSummary, error)
- func (r *EntgoRepository) IfEmailRegistered(ctx context.Context, email string) (bool, error)
- func (r *EntgoRepository) IfSessionRegistered(ctx context.Context, s *domain.UserSession) (bool, error)
- func (r *EntgoRepository) SetChallengeOutcome(ctx context.Context, id uuid.UUID, outcome bool, proofs []*domain.Proof) error
- func (r *EntgoRepository) UpdateChallengeByID(ctx context.Context, ch *domain.Challenge) (*domain.Challenge, error)
- func (r *EntgoRepository) UpdateUserSessionLastActivityBySID(ctx context.Context, sid string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EntgoRepository ¶
type EntgoRepository struct {
// contains filtered or unexported fields
}
func NewEntgoRepository ¶
func NewEntgoRepository( client *ent.Client, logger *logger.Logger, ) *EntgoRepository
func (*EntgoRepository) CreateChallenge ¶
func (*EntgoRepository) CreateOrUpdateBadgeByType ¶
func (*EntgoRepository) CreateOrUpdateChallengeByContent ¶
func (*EntgoRepository) CreateOrUpdateUserSession ¶
func (r *EntgoRepository) CreateOrUpdateUserSession(ctx context.Context, s *domain.UserSession) (*domain.UserSession, error)
CreateOrUpdateUserSession must be used only with authentication like oauth because it updated ip and user agent and in other uses may be vulnerable to session steal
func (*EntgoRepository) CreatePrediction ¶
func (r *EntgoRepository) CreatePrediction(ctx context.Context, pred *domain.Prediction) (*domain.Prediction, error)
func (*EntgoRepository) CreateUser ¶
func (*EntgoRepository) CreateUserSession ¶
func (r *EntgoRepository) CreateUserSession(ctx context.Context, s *domain.UserSession) (*domain.UserSession, error)
func (*EntgoRepository) FilterChallenges ¶
func (r *EntgoRepository) FilterChallenges(ctx context.Context, args *domain.FilterChallengesArgs) ([]*domain.Challenge, int, error)
func (*EntgoRepository) FilterUserChallenges ¶
func (r *EntgoRepository) FilterUserChallenges(ctx context.Context, args *domain.FilterChallengesArgs) ([]*domain.Challenge, int, error)
func (*EntgoRepository) GetChallengeByContent ¶
func (*EntgoRepository) GetChallengeByID ¶
func (*EntgoRepository) GetChallengeCount ¶
func (r *EntgoRepository) GetChallengeCount(ctx context.Context) (int, error)
func (*EntgoRepository) GetChallengesByAuthor ¶ added in v0.0.3
func (*EntgoRepository) GetClosingChallenges ¶
func (r *EntgoRepository) GetClosingChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)
GetClosingChallenges returns challenges that are to be closed soon.
func (*EntgoRepository) GetFinishedChallengeCount ¶
func (r *EntgoRepository) GetFinishedChallengeCount(ctx context.Context) (int, error)
func (*EntgoRepository) GetOngoingChallengeCount ¶
func (r *EntgoRepository) GetOngoingChallengeCount(ctx context.Context) (int, error)
func (*EntgoRepository) GetPopularFinishedChallenges ¶
func (r *EntgoRepository) GetPopularFinishedChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)
GetPopularFinishedChallenges returns finished challenges that have more predictions
func (*EntgoRepository) GetPopularOngoingChallenges ¶
func (r *EntgoRepository) GetPopularOngoingChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)
GetPopularOngoingChallenges returns ongoing challenges that have more predictions
func (*EntgoRepository) GetPredictionByUserAndChallenge ¶
func (r *EntgoRepository) GetPredictionByUserAndChallenge(ctx context.Context, userID, challengeID uuid.UUID) (*domain.Prediction, error)
func (*EntgoRepository) GetPredictionCount ¶
func (r *EntgoRepository) GetPredictionCount(ctx context.Context) (int, error)
func (*EntgoRepository) GetRandomFalseChallenges ¶
func (*EntgoRepository) GetRandomFinishedChallenges ¶
func (*EntgoRepository) GetRandomOngoingChallenges ¶
func (*EntgoRepository) GetRandomPendingChallenges ¶
func (*EntgoRepository) GetRandomTrueChallenges ¶
func (*EntgoRepository) GetUserByEmail ¶
func (*EntgoRepository) GetUserByID ¶
func (*EntgoRepository) GetUserBySession ¶
func (r *EntgoRepository) GetUserBySession(ctx context.Context, s *domain.UserSession) (*domain.User, error)
func (*EntgoRepository) GetUserCount ¶
func (r *EntgoRepository) GetUserCount(ctx context.Context) (int, error)
func (*EntgoRepository) GetUserSummary ¶
func (r *EntgoRepository) GetUserSummary(ctx context.Context, userID uuid.UUID) (*domain.UserSummary, error)
func (*EntgoRepository) IfEmailRegistered ¶
func (*EntgoRepository) IfSessionRegistered ¶
func (r *EntgoRepository) IfSessionRegistered(ctx context.Context, s *domain.UserSession) (bool, error)
func (*EntgoRepository) SetChallengeOutcome ¶
func (*EntgoRepository) UpdateChallengeByID ¶
func (*EntgoRepository) UpdateUserSessionLastActivityBySID ¶
func (r *EntgoRepository) UpdateUserSessionLastActivityBySID(ctx context.Context, sid string) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.