Documentation
¶
Index ¶
- func MarshalDeterministic(m map[string]interface{}) (string, error)
- func NewPostgresDB(cfg PostgresConfig) (*sqlx.DB, error)
- func NewRedisDB(cfg RedisConfig) (*redis.Client, error)
- type AdminPostgres
- func (s *AdminPostgres) BanLevel(levelId int) error
- func (s *AdminPostgres) BanUser(userId int, expirationTime time.Time, reason string) error
- func (s *AdminPostgres) ChangeUserAccess(userId int, newAccess int) error
- func (s *AdminPostgres) DeleteLevelComplaint(moderatorId int, complaintId int) error
- func (s *AdminPostgres) DeleteUserComplaint(moderatorId int, complaintId int) error
- func (s *AdminPostgres) GetLevelComplaints(moderatorId int) ([]complaints.LevelComplaint, error)
- func (s *AdminPostgres) GetUserAccess(id int) (int, error)
- func (s *AdminPostgres) GetUserComplaints(moderatorId int) ([]complaints.UserComplaint, error)
- func (s *AdminPostgres) GetUsers(params user.UserSearchParams) ([]user.UserInfo, error)
- func (s *AdminPostgres) UnbanLevel(levelId int) error
- func (s *AdminPostgres) UnbanUser(userId int) error
- type AuthPostgres
- func (s *AuthPostgres) CreateSeniorAdmin(name string, password string) error
- func (s *AuthPostgres) CreateStats(tx *sql.Tx, userId int) error
- func (s *AuthPostgres) CreateUser(user user.User) (int, int, string, error)
- func (s *AuthPostgres) GetUser(username, password string) (user.User, error)
- func (s *AuthPostgres) GetUserById(id int) (user.User, error)
- func (s *AuthPostgres) SetUserRefreshToken(id int, refreshToken string, expiresAt time.Time) (int, int, string, error)
- type LevelPostgres
- func (lp *LevelPostgres) CreateLevel(level levels.Level) (string, string, int, error)
- func (lp *LevelPostgres) DeleteLevel(levelId int) error
- func (lp *LevelPostgres) FetchLevels(params map[string]interface{}) ([]levels.Level, error)
- func (lp *LevelPostgres) GetLevelById(levelId int) (levels.Level, error)
- func (lp *LevelPostgres) GetLevelStats(levelId int) (statistics.LevelStats, error)
- func (sp *LevelPostgres) GetLevelStatsFromCache(levelId int) (statistics.LevelStats, error)
- func (lp *LevelPostgres) GetLevelUserTop(levelId int) ([]statistics.UserLevelCompletionInfo, error)
- func (sp *LevelPostgres) GetLevelUserTopFromCache(levelId int) ([]statistics.UserLevelCompletionInfo, error)
- func (lp *LevelPostgres) GetPathsById(levelId int) (int, string, string, error)
- func (lp *LevelPostgres) GetTagsByLevelID(levelID int) ([]levels.Tag, error)
- func (lp *LevelPostgres) InsertTags(tx *sqlx.Tx, levelID int, tags []string) error
- func (sp *LevelPostgres) SaveLevelStatsInCache(levelId int, result statistics.LevelStats) error
- func (sp *LevelPostgres) SaveLevelUserTopInCache(levelId int, result []statistics.UserLevelCompletionInfo) error
- func (lp *LevelPostgres) UpdateLevel(levelInfo levels.LevelUpdateStruct) (string, string, int, error)
- type LocalFileRepository
- type PostgresConfig
- type RedisConfig
- type Repository
- type SinglePlayerGamePostgres
- type StatsPostgres
- func (sp *StatsPostgres) GetUserStats(id int) (statistics.PlayerStats, error)
- func (sp *StatsPostgres) GetUserTopFromCache(params map[string]interface{}) ([]statistics.PlayerStats, error)
- func (sp *StatsPostgres) GetUsersTop(params map[string]interface{}) ([]statistics.PlayerStats, error)
- func (sp *StatsPostgres) SaveUserTopInCache(params map[string]interface{}, result []statistics.PlayerStats) error
- type UserActionsPostgres
- func (s *UserActionsPostgres) CreateLevelComplaint(complaint complaints.LevelComplaint) error
- func (s *UserActionsPostgres) CreateUserComplaint(complaint complaints.UserComplaint) error
- func (s *UserActionsPostgres) DropRefreshToken(id int, newTime time.Time) (int, error)
- func (s *UserActionsPostgres) GetUserById(id int) (string, int, time.Time, string, sql.NullString, error)
- func (s *UserActionsPostgres) UpdateAvatarPath(id int, newPath string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalDeterministic ¶
func NewPostgresDB ¶
func NewPostgresDB(cfg PostgresConfig) (*sqlx.DB, error)
func NewRedisDB ¶
func NewRedisDB(cfg RedisConfig) (*redis.Client, error)
Types ¶
type AdminPostgres ¶
type AdminPostgres struct {
// contains filtered or unexported fields
}
func NewAdminPostgres ¶
func NewAdminPostgres(db *sqlx.DB) *AdminPostgres
func (*AdminPostgres) BanLevel ¶
func (s *AdminPostgres) BanLevel(levelId int) error
func (*AdminPostgres) ChangeUserAccess ¶
func (s *AdminPostgres) ChangeUserAccess(userId int, newAccess int) error
func (*AdminPostgres) DeleteLevelComplaint ¶
func (s *AdminPostgres) DeleteLevelComplaint(moderatorId int, complaintId int) error
func (*AdminPostgres) DeleteUserComplaint ¶
func (s *AdminPostgres) DeleteUserComplaint(moderatorId int, complaintId int) error
func (*AdminPostgres) GetLevelComplaints ¶
func (s *AdminPostgres) GetLevelComplaints(moderatorId int) ([]complaints.LevelComplaint, error)
func (*AdminPostgres) GetUserAccess ¶
func (s *AdminPostgres) GetUserAccess(id int) (int, error)
func (*AdminPostgres) GetUserComplaints ¶
func (s *AdminPostgres) GetUserComplaints(moderatorId int) ([]complaints.UserComplaint, error)
func (*AdminPostgres) GetUsers ¶
func (s *AdminPostgres) GetUsers(params user.UserSearchParams) ([]user.UserInfo, error)
func (*AdminPostgres) UnbanLevel ¶
func (s *AdminPostgres) UnbanLevel(levelId int) error
func (*AdminPostgres) UnbanUser ¶
func (s *AdminPostgres) UnbanUser(userId int) error
type AuthPostgres ¶
type AuthPostgres struct {
// contains filtered or unexported fields
}
func NewAuthPostgres ¶
func NewAuthPostgres(db *sqlx.DB) *AuthPostgres
func (*AuthPostgres) CreateSeniorAdmin ¶
func (s *AuthPostgres) CreateSeniorAdmin(name string, password string) error
func (*AuthPostgres) CreateStats ¶
func (s *AuthPostgres) CreateStats(tx *sql.Tx, userId int) error
func (*AuthPostgres) CreateUser ¶
func (*AuthPostgres) GetUser ¶
func (s *AuthPostgres) GetUser(username, password string) (user.User, error)
func (*AuthPostgres) GetUserById ¶
func (s *AuthPostgres) GetUserById(id int) (user.User, error)
type LevelPostgres ¶
type LevelPostgres struct {
// contains filtered or unexported fields
}
TODO: Finish sorting
func NewLevelPostgres ¶
func NewLevelPostgres(db *sqlx.DB, client *redis.Client, levelUserTopTTL, levelStatsTTL int) *LevelPostgres
func NewLevelPostgresMock ¶
func NewLevelPostgresMock(db *sqlx.DB, client *redis.Client) *LevelPostgres
func (*LevelPostgres) CreateLevel ¶
func (*LevelPostgres) DeleteLevel ¶
func (lp *LevelPostgres) DeleteLevel(levelId int) error
func (*LevelPostgres) FetchLevels ¶
func (lp *LevelPostgres) FetchLevels(params map[string]interface{}) ([]levels.Level, error)
func (*LevelPostgres) GetLevelById ¶
func (lp *LevelPostgres) GetLevelById(levelId int) (levels.Level, error)
func (*LevelPostgres) GetLevelStats ¶
func (lp *LevelPostgres) GetLevelStats(levelId int) (statistics.LevelStats, error)
func (*LevelPostgres) GetLevelStatsFromCache ¶
func (sp *LevelPostgres) GetLevelStatsFromCache(levelId int) (statistics.LevelStats, error)
func (*LevelPostgres) GetLevelUserTop ¶
func (lp *LevelPostgres) GetLevelUserTop(levelId int) ([]statistics.UserLevelCompletionInfo, error)
func (*LevelPostgres) GetLevelUserTopFromCache ¶
func (sp *LevelPostgres) GetLevelUserTopFromCache(levelId int) ([]statistics.UserLevelCompletionInfo, error)
func (*LevelPostgres) GetPathsById ¶
func (*LevelPostgres) GetTagsByLevelID ¶
func (lp *LevelPostgres) GetTagsByLevelID(levelID int) ([]levels.Tag, error)
func (*LevelPostgres) InsertTags ¶
func (*LevelPostgres) SaveLevelStatsInCache ¶
func (sp *LevelPostgres) SaveLevelStatsInCache(levelId int, result statistics.LevelStats) error
func (*LevelPostgres) SaveLevelUserTopInCache ¶
func (sp *LevelPostgres) SaveLevelUserTopInCache(levelId int, result []statistics.UserLevelCompletionInfo) error
func (*LevelPostgres) UpdateLevel ¶
func (lp *LevelPostgres) UpdateLevel(levelInfo levels.LevelUpdateStruct) (string, string, int, error)
type LocalFileRepository ¶
type LocalFileRepository struct{}
func NewLocalFileRepository ¶
func NewLocalFileRepository() *LocalFileRepository
func (*LocalFileRepository) DeleteFile ¶
func (r *LocalFileRepository) DeleteFile(path string) error
func (*LocalFileRepository) SaveFile ¶
func (r *LocalFileRepository) SaveFile(file *multipart.FileHeader, filePath string) error
type PostgresConfig ¶
type RedisConfig ¶
type Repository ¶
type Repository struct { Authorization repository.Authorization UserActions repository.UserActions AdminActions repository.Admin Level repository.Level Stats repository.Stats SinglePlayerGame repository.SinglePlayerGame Files repository.Files }
func NewRepository ¶
func NewRepository(db *sqlx.DB, client *redis.Client, levelUserTopTTL, levelStatsTTL, ratingTTL int) *Repository
type SinglePlayerGamePostgres ¶
type SinglePlayerGamePostgres struct {
// contains filtered or unexported fields
}
func NewSinglePlayerGamePostgres ¶
func NewSinglePlayerGamePostgres(db *sqlx.DB) *SinglePlayerGamePostgres
func (*SinglePlayerGamePostgres) SendResults ¶
func (s *SinglePlayerGamePostgres) SendResults(lc statistics.LevelComplete, totalPush int, totalErr int) error
type StatsPostgres ¶
type StatsPostgres struct {
// contains filtered or unexported fields
}
func NewStatsPostgres ¶
func NewStatsPostgres(db *sqlx.DB, client *redis.Client, ratingTtl int) *StatsPostgres
func NewStatsPostgresMock ¶
func NewStatsPostgresMock(db *sqlx.DB, client *redis.Client) *StatsPostgres
func (*StatsPostgres) GetUserStats ¶
func (sp *StatsPostgres) GetUserStats(id int) (statistics.PlayerStats, error)
func (*StatsPostgres) GetUserTopFromCache ¶
func (sp *StatsPostgres) GetUserTopFromCache(params map[string]interface{}) ([]statistics.PlayerStats, error)
func (*StatsPostgres) GetUsersTop ¶
func (sp *StatsPostgres) GetUsersTop(params map[string]interface{}) ([]statistics.PlayerStats, error)
func (*StatsPostgres) SaveUserTopInCache ¶
func (sp *StatsPostgres) SaveUserTopInCache(params map[string]interface{}, result []statistics.PlayerStats) error
type UserActionsPostgres ¶
type UserActionsPostgres struct {
// contains filtered or unexported fields
}
func NewUserActionsPostgres ¶
func NewUserActionsPostgres(db *sqlx.DB) *UserActionsPostgres
func (*UserActionsPostgres) CreateLevelComplaint ¶
func (s *UserActionsPostgres) CreateLevelComplaint(complaint complaints.LevelComplaint) error
func (*UserActionsPostgres) CreateUserComplaint ¶
func (s *UserActionsPostgres) CreateUserComplaint(complaint complaints.UserComplaint) error
func (*UserActionsPostgres) DropRefreshToken ¶
func (*UserActionsPostgres) GetUserById ¶
func (s *UserActionsPostgres) GetUserById(id int) (string, int, time.Time, string, sql.NullString, error)
func (*UserActionsPostgres) UpdateAvatarPath ¶
func (s *UserActionsPostgres) UpdateAvatarPath(id int, newPath string) (string, error)
Click to show internal directories.
Click to hide internal directories.