entgo

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

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 (r *EntgoRepository) CreateChallenge(ctx context.Context, ch *domain.Challenge) (*domain.Challenge, error)

func (*EntgoRepository) CreateOrUpdateBadgeByType

func (r *EntgoRepository) CreateOrUpdateBadgeByType(ctx context.Context, b *domain.Badge) (*domain.Badge, error)

func (*EntgoRepository) CreateOrUpdateChallengeByContent

func (r *EntgoRepository) CreateOrUpdateChallengeByContent(ctx context.Context, ch *domain.Challenge) (*domain.Challenge, error)

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 (r *EntgoRepository) CreateUser(ctx context.Context, u *domain.User) (*domain.User, error)

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 (r *EntgoRepository) GetChallengeByContent(ctx context.Context, content string) (*domain.Challenge, error)

func (*EntgoRepository) GetChallengeByID

func (r *EntgoRepository) GetChallengeByID(ctx context.Context, id uuid.UUID, userID uuid.UUID) (*domain.Challenge, error)

func (*EntgoRepository) GetChallengeCount

func (r *EntgoRepository) GetChallengeCount(ctx context.Context) (int, error)

func (*EntgoRepository) GetChallengesByAuthor added in v0.0.3

func (r *EntgoRepository) GetChallengesByAuthor(ctx context.Context, authorID uuid.UUID, limit, offset int) ([]*domain.Challenge, int, error)

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 (r *EntgoRepository) GetRandomFalseChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)

func (*EntgoRepository) GetRandomFinishedChallenges

func (r *EntgoRepository) GetRandomFinishedChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)

func (*EntgoRepository) GetRandomOngoingChallenges

func (r *EntgoRepository) GetRandomOngoingChallenges(ctx context.Context, limit int, userID uuid.UUID) ([]*domain.Challenge, error)

func (*EntgoRepository) GetRandomPendingChallenges

func (r *EntgoRepository) GetRandomPendingChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)

func (*EntgoRepository) GetRandomTrueChallenges

func (r *EntgoRepository) GetRandomTrueChallenges(ctx context.Context, limit int) ([]*domain.Challenge, error)

func (*EntgoRepository) GetUserByEmail

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

func (*EntgoRepository) GetUserByID

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

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 (r *EntgoRepository) IfEmailRegistered(ctx context.Context, email string) (bool, error)

func (*EntgoRepository) IfSessionRegistered

func (r *EntgoRepository) IfSessionRegistered(ctx context.Context, s *domain.UserSession) (bool, error)

func (*EntgoRepository) SetChallengeOutcome

func (r *EntgoRepository) SetChallengeOutcome(ctx context.Context, id uuid.UUID, outcome bool, proofs []*domain.Proof) error

func (*EntgoRepository) UpdateChallengeByID

func (r *EntgoRepository) UpdateChallengeByID(ctx context.Context, ch *domain.Challenge) (*domain.Challenge, error)

func (*EntgoRepository) UpdateUserSessionLastActivityBySID

func (r *EntgoRepository) UpdateUserSessionLastActivityBySID(ctx context.Context, sid string) error

Directories

Path Synopsis
ent

Jump to

Keyboard shortcuts

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