Documentation ¶
Index ¶
- Constants
- Variables
- func AddFriend(userId int, targetUserId int) error
- func AddUserActivity(userId int, activityType UserActivityType, value string, mapsetId int) error
- func CacheCountryPlayersInRedis() (map[string]string, error)
- func CacheJsonInRedis(key string, data interface{}, duration time.Duration, ignoreCache bool, ...) error
- func CacheTotalMapsetsInRedis()
- func CacheTotalScoresInRedis()
- func CacheTotalUsersInRedis()
- func CalculateOverallAccuracy(scores []*Score) float64
- func CalculateOverallRating(scores []*Score) float64
- func CanUserChangeUsername(userId int) (bool, time.Time, error)
- func ChangeUserUsername(userId int, currentName string, username string) (changed bool, unchangedReason string, err error)
- func ClanLeaderboardKey(mode enums.GameMode) string
- func CloseMySQL()
- func ConnectMySQL()
- func CountryLeaderboardRedisKey(country string, mode enums.GameMode) string
- func CreateElasticIndex(index string) error
- func DeactivateRankingQueueActions(mapsetId int) error
- func DeleteClan(id int) error
- func DeleteClanInviteById(id int) error
- func DeleteElasticIndices(indices ...string) error
- func DeleteElasticSearchMapset(id int) error
- func DeleteMap(id int) error
- func DeleteMapset(id int) error
- func DeletePinnedScore(userId int, scoreId int) error
- func DeletePlaylistMap(playlistId int, mapId int) error
- func DeletePlaylistMapset(playlistId int, mapsetId int) error
- func DeleteUserClanInvites(userId int) error
- func DoesClanExistByName(name string) (bool, error)
- func DoesPlaylistContainMap(playlistId int, mapId int) (bool, error)
- func GetBundledMapMd5s() ([]string, error)
- func GetCountryPlayerCountFromRedis(country string) (int, error)
- func GetMapsetOnlineOffsets() (interface{}, error)
- func GetNotificationCount(userId int, unreadOnly bool, category UserNotificationCategory) (int64, error)
- func GetOnlineUserCountFromRedis() (int, error)
- func GetRankedMapsetIds() ([]int, error)
- func GetRankingQueueCount(mode enums.GameMode) (int, error)
- func GetTotalCountryPlayersFromRedis() (int, error)
- func GetTotalMapsetCountFromRedis() (int, error)
- func GetTotalMultiplayerGameCount() (int, error)
- func GetTotalPlaylistCount(query string) (int, error)
- func GetTotalScoreCountFromRedis() (int, error)
- func GetTotalUnbannedUserCount() (int, error)
- func GetTotalUnreadNotifications(userId int) (int64, error)
- func GetTotalUserCountFromRedis() (int, error)
- func GetUserStripeSubscriptions(userId int) ([]*stripe.Subscription, error)
- func GlobalLeaderboardRedisKey(mode enums.GameMode) string
- func IndexAllElasticSearchMapsets(deletePrevious bool) error
- func IndexElasticSearchMapset(mapset Mapset) error
- func InitializeElasticSearch()
- func InitializeRedis()
- func InsertCrashLog(cl *CrashLog) error
- func InsertMap(m *MapQua) error
- func InsertMapsetDownload(download *MapsetDownload) error
- func IsUsernameAvailable(userId int, username string) (bool, error)
- func IsValidClanName(name string) bool
- func IsValidClanTag(tag string) bool
- func PerformFullClanRecalculation(clan *Clan) error
- func RankMapset(id int) error
- func RecalculateClanStats(id int, mode enums.GameMode, newScore ...*RedisScore) error
- func RemoveClanFromLeaderboards(clanId int) error
- func RemoveFriend(userId int, targetUserId int) error
- func RemoveUserClanScores(clanId int, userId int) error
- func RemoveUserFromLeaderboards(user *User) error
- func ReplaceUserFirstPlaces(userId int) error
- func ResetPersonalBests(mapset *Mapset) error
- func SyncPinnedScoreSortOrder(userId int, mode enums.GameMode) error
- func TotalHitsLeaderboardRedisKey() string
- func UpdateAllClanLeaderboards(clan *Clan) error
- func UpdateClanLeaderboard(clan *Clan, mode enums.GameMode) error
- func UpdateElasticSearchMapset(mapset Mapset) error
- func UpdateFirstPlace(md5 string, score *Score) error
- func UpdateMapDifficultyRating(id int, difficultyRating float64) error
- func UpdateMapMD5(id int, md5 string) error
- func UpdateMapsetDescription(id int, description string) error
- func UpdateMapsetPackageMD5(id int, md5 string) error
- func UpdatePinnedScoreSortOrder(userId int, scoreId int, sortOrder int) error
- func UpdatePlaylistMapCount(id int, count int) error
- func UpdateUserAboutMe(userId int, aboutMe string) error
- func UpdateUserAllowed(userId int, isAllowed bool) error
- func UpdateUserClan(userId int, clanId ...int) error
- func UpdateUserDiscordId(userId int, discordId *string) error
- func UpdateUserUsername(userId int, username string) error
- func UserHasBadge(userId int, badgeId int) (bool, error)
- type Achievement
- type AdminActionLog
- type AdminActionLogType
- type Application
- func (app *Application) AfterFind(db *gorm.DB) error
- func (app *Application) BeforeCreate(*gorm.DB) (err error)
- func (app *Application) SetActiveStatus(active bool) error
- func (app *Application) SetClientSecret(secret string) error
- func (app *Application) SetName(name string) error
- func (app *Application) SetRedirectURL(url string) error
- func (*Application) TableName() string
- type Badge
- type BoolQuery
- type ChatMessage
- type Clan
- func (clan *Clan) AfterFind(*gorm.DB) (err error)
- func (clan *Clan) BeforeCreate(*gorm.DB) (err error)
- func (clan *Clan) Insert() error
- func (clan *Clan) UpdateAboutMe(aboutMe string) error
- func (clan *Clan) UpdateCustomizable(enabled bool) error
- func (clan *Clan) UpdateFavoriteMode(mode enums.GameMode) error
- func (clan *Clan) UpdateName(name string) error
- func (clan *Clan) UpdateOwner(ownerId int) error
- func (clan *Clan) UpdateTag(tag string) error
- type ClanActivity
- type ClanActivityType
- type ClanInvite
- func GetClanInviteById(id int) (*ClanInvite, error)
- func GetPendingClanInvite(clanId int, userId int) (*ClanInvite, error)
- func GetPendingClanInvites(clanId int) ([]*ClanInvite, error)
- func GetUserClanInvites(userId int) ([]*ClanInvite, error)
- func InviteUserToClan(clanId int, userId int) (*ClanInvite, error)
- type ClanScore
- func CalculateClanScore(md5 string, clanId int, mode enums.GameMode) (*ClanScore, error)
- func GetClanScore(md5 string, clanId int) (*ClanScore, error)
- func GetClanScoreById(id int) (*ClanScore, error)
- func GetClanScoreboardForMap(md5 string) ([]*ClanScore, error)
- func GetClanScoresForMode(clanId int, mode enums.GameMode) ([]*ClanScore, error)
- func GetClanScoresForModeFull(clanId int, mode enums.GameMode, page int) ([]*ClanScore, error)
- type ClanStats
- type Collapse
- type CrashLog
- type ElasticHits
- type ElasticMap
- type ElasticMapsetSearchOptions
- type GameBuild
- type InnerHits
- type MapMod
- type MapModComment
- type MapModStatus
- type MapModType
- type MapQua
- type Mapset
- type MapsetDownload
- type MapsetDownloadMethod
- type MapsetRankingQueueComment
- func GetRankingQueueComment(id int) (*MapsetRankingQueueComment, error)
- func GetRankingQueueComments(mapsetId int) ([]*MapsetRankingQueueComment, error)
- func GetRankingQueueDenies(mapsetId int) ([]*MapsetRankingQueueComment, error)
- func GetRankingQueueVotes(mapsetId int) ([]*MapsetRankingQueueComment, error)
- func GetUserRankingQueueComments(userId int, timeStart int64, timeEnd int64) ([]*MapsetRankingQueueComment, error)
- type MultiplayerGame
- type MultiplayerGameMatches
- type MultiplayerMapShare
- type MultiplayerMatchScore
- type Number
- type Order
- func (order *Order) AfterFind(*gorm.DB) (err error)
- func (order *Order) Finalize() error
- func (order *Order) FinalizeBadge() error
- func (order *Order) FinalizeClanCustomizable() error
- func (order *Order) FinalizeDonator() error
- func (order *Order) Insert() error
- func (order *Order) SetReceiver(payer *User, giftUserId int) (bool, error)
- func (*Order) TableName() string
- type OrderItem
- type OrderItemCategory
- type OrderItemId
- type OrderStatus
- type OrderSubscriptionStripe
- type PinnedScore
- type Playlist
- func (p *Playlist) AfterFind(*gorm.DB) (err error)
- func (p *Playlist) BeforeSave(*gorm.DB) (err error)
- func (p *Playlist) Insert() error
- func (*Playlist) TableName() string
- func (p *Playlist) UpdateDescription(description string) error
- func (p *Playlist) UpdateName(name string) error
- func (p *Playlist) UpdateVisibility(visible bool) error
- type PlaylistMap
- type PlaylistMapset
- type Query
- type QueryString
- type Range
- type RangeCustom
- type RankingQueueAction
- type RankingQueueMapset
- func (mapset *RankingQueueMapset) AfterFind(*gorm.DB) (err error)
- func (mapset *RankingQueueMapset) Insert() error
- func (*RankingQueueMapset) TableName() string
- func (mapset *RankingQueueMapset) UpdateStatus(status RankingQueueStatus) error
- func (mapset *RankingQueueMapset) UpdateVoteCount(votes int) error
- type RankingQueueStatus
- type RedisScore
- type Score
- func GetAllScoresForMap(md5 string) ([]*Score, error)
- func GetClanPlayerScoresOnMap(md5 string, clanId int, callAfterFind bool) ([]*Score, error)
- func GetCountryScoresForMap(md5 string, country string) ([]*Score, error)
- func GetFriendScoresForMap(md5 string, userId int, friends []*UserFriend, limit int, page int) ([]*Score, error)
- func GetGlobalScoresForMap(md5 string, useCache bool) ([]*Score, error)
- func GetModifierScoresForMap(md5 string, mods int64) ([]*Score, error)
- func GetRateScoresForMap(md5 string, mods int64) ([]*Score, error)
- func GetScoreById(id int) (*Score, error)
- func GetUserBestScoresForMode(id int, mode enums.GameMode, limit int, page int) ([]*Score, error)
- func GetUserFirstPlaceScoresForMode(id int, mode enums.GameMode, limit int, page int) ([]*Score, error)
- func GetUserGradeScoresForMode(id int, mode enums.GameMode, grade string, limit int, page int) ([]*Score, error)
- func GetUserPersonalBestScoreAll(userId int, md5 string) (*Score, error)
- func GetUserPersonalBestScoreGlobal(userId int, md5 string) (*Score, error)
- func GetUserPersonalBestScoreMods(userId int, md5 string, mods int64) (*Score, error)
- func GetUserPersonalBestScoreRate(userId int, md5 string, mods int64) (*Score, error)
- func GetUserRecentScoresForMode(id int, mode enums.GameMode, isDonator bool, limit int, page int) ([]*Score, error)
- type ScoreFirstPlace
- type SortOrder
- type Team
- type Term
- type TermCustom
- type User
- func GetCountryLeaderboard(country string, mode enums.GameMode, page int, limit int) ([]*User, error)
- func GetGlobalLeaderboard(mode enums.GameMode, page int, limit int) ([]*User, error)
- func GetRankingSupervisors(ignoreCache bool) ([]*User, error)
- func GetTotalHitsLeaderboard(page int, limit int) ([]*User, error)
- func GetUserById(id int) (*User, error)
- func GetUserBySteamId(id string) (*User, error)
- func GetUserByUsername(username string) (*User, error)
- func GetUsersInClan(clanId int) ([]*User, error)
- func SearchUsersByName(searchQuery string) ([]*User, error)
- func (u *User) AfterFind(*gorm.DB) (err error)
- func (u *User) BeforeCreate(*gorm.DB) (err error)
- func (u *User) CanJoinClan() bool
- func (u *User) Insert() error
- func (u *User) IsTrialRankingSupervisor() bool
- func (u *User) UpdateDonatorEndTime(endTime int64) error
- func (u *User) UpdateUserGroups(groups enums.UserGroups) error
- type UserAchievement
- type UserActivity
- type UserActivityType
- type UserBadge
- type UserClientStatus
- type UserFriend
- type UserInformation
- type UserMostPlayedMap
- type UserNotification
- func GetNotificationById(id int) (*UserNotification, error)
- func GetNotifications(userId int, unreadOnly bool, page int, limit int, ...) ([]*UserNotification, error)
- func NewClanInviteNotification(clan *Clan, invite *ClanInvite) *UserNotification
- func NewClanKickedNotification(clan *Clan, userId int) *UserNotification
- func NewDonatorExpiredNotification(userId int) *UserNotification
- func NewMapModCommentNotification(mapQua *MapQua, mod *MapMod, comment *MapModComment) *UserNotification
- func NewMapModNotification(mapQua *MapQua, mod *MapMod) *UserNotification
- func NewMapsetActionNotification(mapset *Mapset, comment *MapsetRankingQueueComment) *UserNotification
- func NewMapsetRankedNotification(mapset *Mapset) *UserNotification
- func NewOrderItemGiftNotification(order *Order) *UserNotification
- type UserNotificationCategory
- type UserNotificationType
- type UserRank
- type UserRankKeys4
- type UserRankKeys7
- type UserRanks
- type UserRelationship
- type UserStats
- type UserStatsKeys4
- type UserStatsKeys7
- type UsernameChange
- type WeeklyMostPlayedMapsets
Constants ¶
const ( ModStatusPending MapModStatus = "Pending" ModStatusAccepted MapModStatus = "Accepted" ModStatusDenied MapModStatus = "Denied" ModStatusIgnored MapModStatus = "Ignored" ModTypeIssue MapModType = "Issue" ModTypeSuggestion MapModType = "Suggestion" )
const (
QuaverBotId int = 2
)
Variables ¶
var ( Redis *redis.Client RedisCtx = context.Background() )
var ElasticSearch *elasticsearch.Client
var SQL *gorm.DB
The SQL database to use throughout the application
Functions ¶
func AddUserActivity ¶
func AddUserActivity(userId int, activityType UserActivityType, value string, mapsetId int) error
AddUserActivity Adds a new user activity to the database
func CacheCountryPlayersInRedis ¶
CacheCountryPlayersInRedis Caches the amount of country players in redis
func CacheJsonInRedis ¶
func CacheJsonInRedis(key string, data interface{}, duration time.Duration, ignoreCache bool, fetch func() error) error
Helper function to cache json data in redis. The data parameter should be a pointer to the object that you're populating
func CacheTotalMapsetsInRedis ¶
func CacheTotalMapsetsInRedis()
CacheTotalMapsetsInRedis Caches the number of total scores in redis
func CacheTotalScoresInRedis ¶
func CacheTotalScoresInRedis()
CacheTotalScoresInRedis Caches the number of total scores in redis
func CacheTotalUsersInRedis ¶
func CacheTotalUsersInRedis()
CacheTotalUsersInRedis Caches the number of total scores in redis
func CalculateOverallAccuracy ¶
CalculateOverallAccuracy Calculates overall accuracy from a list of scores
func CalculateOverallRating ¶
CalculateOverallRating Calculates overall rating from a list of scores
func CanUserChangeUsername ¶
CanUserChangeUsername Checks and returns if the user is allowed to change their username. When a user changes their username, they are required to wait at least 30 days before they can change it again. Returns if the user can change, the time left to change, and an error.
func ChangeUserUsername ¶
func ChangeUserUsername(userId int, currentName string, username string) (changed bool, unchangedReason string, err error)
ChangeUserUsername Changes a user's username
func ClanLeaderboardKey ¶
func CreateElasticIndex ¶
CreateElasticIndex Creates a new elastic search index by a given name
func DeactivateRankingQueueActions ¶
DeactivateRankingQueueActions "De-activates" ranking queue actions. This means that these specific actions do not currently count towards ranking. Example - If a mapset gets denied, all previous actions (votes/denies) no longer count
func DeleteClanInviteById ¶
DeleteClanInviteById Deletes an individual clan invite
func DeleteElasticIndices ¶
DeleteElasticIndices Deletes one or many elastic search indices
func DeleteElasticSearchMapset ¶
DeleteElasticSearchMapset Deletes an individual mapset in elastic
func DeletePinnedScore ¶
DeletePinnedScore Deletes a pinned score
func DeletePlaylistMap ¶
DeletePlaylistMap Deletes a playlist map row
func DeletePlaylistMapset ¶
DeletePlaylistMapset Deletes a playlist mapset row
func DeleteUserClanInvites ¶
DeleteUserClanInvites Deletes all of a user's clan invites
func DoesClanExistByName ¶
DoesClanExistByName Returns if a clan exists by its name
func DoesPlaylistContainMap ¶
DoesPlaylistContainMap Checks if a playlist contains a specific map id
func GetBundledMapMd5s ¶
func GetCountryPlayerCountFromRedis ¶
GetCountryPlayerCountFromRedis Gets the total amount of users from a given country in redis
func GetMapsetOnlineOffsets ¶
func GetMapsetOnlineOffsets() (interface{}, error)
GetMapsetOnlineOffsets Retrieves a list of online offsets
func GetNotificationCount ¶
func GetNotificationCount(userId int, unreadOnly bool, category UserNotificationCategory) (int64, error)
GetNotificationCount Gets the total amount of notifications that match a given filter
func GetOnlineUserCountFromRedis ¶
GetOnlineUserCountFromRedis Retrieves the amount of online users from redis
func GetRankedMapsetIds ¶
GetRankedMapsetIds Retrieves a list of ranked mapset ids
func GetRankingQueueCount ¶
GetRankingQueueCount Gets the total amount of maps in the ranking queue
func GetTotalCountryPlayersFromRedis ¶
GetTotalCountryPlayersFromRedis Retrieves the total amount of users on the country leaderboard
func GetTotalMapsetCountFromRedis ¶
GetTotalMapsetCountFromRedis Retrieves the total amount of mapsets from redis
func GetTotalMultiplayerGameCount ¶
GetTotalMultiplayerGameCount Gets the total amount of multiplayer game
func GetTotalPlaylistCount ¶
GetTotalPlaylistCount Retrieves the total amount of playlists that match a given query
func GetTotalScoreCountFromRedis ¶
GetTotalScoreCountFromRedis Retrieves the total amount of scores from redis
func GetTotalUnbannedUserCount ¶
GetTotalUnbannedUserCount Returns the total amount of users
func GetTotalUnreadNotifications ¶
GetTotalUnreadNotifications Retrieves the total amount of unread notifications the user has
func GetTotalUserCountFromRedis ¶
GetTotalUserCountFromRedis Retrieves the total amount of users from redis
func GetUserStripeSubscriptions ¶
GetUserStripeSubscriptions Gets a user's active stripe subscriptions
func IndexAllElasticSearchMapsets ¶
IndexAllElasticSearchMapsets Indexes all mapsets in the DB in ElasticSearch
func IndexElasticSearchMapset ¶
IndexElasticSearchMapset Indexes an individual mapset in elastic
func InitializeElasticSearch ¶
func InitializeElasticSearch()
InitializeElasticSearch Initializes the ElasticSearch client
func InsertCrashLog ¶
InsertCrashLog Inserts a crash log into the database
func InsertMapsetDownload ¶
func InsertMapsetDownload(download *MapsetDownload) error
InsertMapsetDownload Inserts a mapset download into the database
func IsUsernameAvailable ¶
IsUsernameAvailable Returns if a username is available to use. - A user must not already be using that name - A user must not have used that name in the past 60 days.
func IsValidClanName ¶
IsValidClanName Checks a string to see if it is a valid clan name
func IsValidClanTag ¶
IsValidClanTag Checks a string to see if it is a valid clan tag
func PerformFullClanRecalculation ¶
PerformFullClanRecalculation Recalculates all of a clan's scores + stats
func RecalculateClanStats ¶
func RecalculateClanStats(id int, mode enums.GameMode, newScore ...*RedisScore) error
RecalculateClanStats Recalculates a clan stats for a given mode.
func RemoveClanFromLeaderboards ¶
RemoveClanFromLeaderboards Removes a clan from a given leaderboard
func RemoveFriend ¶
RemoveFriend Removes a friend from the database
func RemoveUserClanScores ¶
RemoveUserClanScores Removes all user scores from a clan
func RemoveUserFromLeaderboards ¶
RemoveUserFromLeaderboards Removes a user from all leaderboards
func ReplaceUserFirstPlaces ¶
ReplaceUserFirstPlaces Goes through a user's first place scores and replaces it with the next unbanned player. This is used specifically when a player is banned.
func ResetPersonalBests ¶
ResetPersonalBests Resets the personal best scores of all maps in a set. Usually used when ranking a mapset
func SyncPinnedScoreSortOrder ¶
SyncPinnedScoreSortOrder Resets the order of pinned scores to keep things in sync
func TotalHitsLeaderboardRedisKey ¶
func TotalHitsLeaderboardRedisKey() string
func UpdateAllClanLeaderboards ¶
UpdateAllClanLeaderboards Updates the clan leaderboards for every mode
func UpdateClanLeaderboard ¶
UpdateClanLeaderboard Adds a clan to a given leaderboard
func UpdateElasticSearchMapset ¶
UpdateElasticSearchMapset Updates an individual mapset in elastic
func UpdateFirstPlace ¶
func UpdateMapDifficultyRating ¶
UpdateMapDifficultyRating Updates the difficulty rating of a map
func UpdateMapMD5 ¶
UpdateMapMD5 Updates the md5 hash of a map
func UpdateMapsetDescription ¶
UpdateMapsetDescription Updates a given mapset's description
func UpdateMapsetPackageMD5 ¶
UpdateMapsetPackageMD5 Updates the package md5 of a mapset
func UpdatePinnedScoreSortOrder ¶
UpdatePinnedScoreSortOrder Updates the sort order of a given pinned score.
func UpdatePlaylistMapCount ¶
UpdatePlaylistMapCount Updates the map count for a playlist
func UpdateUserAboutMe ¶
UpdateUserAboutMe Updates a user's about me
func UpdateUserAllowed ¶
UpdateUserAllowed Updates whether the user is allowed to play (banned)
func UpdateUserClan ¶
UpdateUserClan Updates a given user's clan in the database. Not passing in any clan id will set it to NULL.
func UpdateUserDiscordId ¶
UpdateUserDiscordId Updates a user's discord id
func UpdateUserUsername ¶
UpdateUserUsername Updates a user's username
Types ¶
type Achievement ¶
type Achievement struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` Difficulty string `gorm:"column:difficulty" json:"difficulty"` SteamAPIName string `gorm:"column:steam_api_name" json:"steam_api_name"` Name string `gorm:"column:name" json:"name"` Description string `gorm:"column:description" json:"description"` IsUnlocked bool `gorm:"-:all" json:"is_unlocked"` }
func GetUserAchievements ¶
func GetUserAchievements(id int) ([]*Achievement, error)
GetUserAchievements Gets a user's unlocked achievements
func (*Achievement) TableName ¶
func (*Achievement) TableName() string
type AdminActionLog ¶
type AdminActionLog struct { Id int `gorm:"column:id; PRIMARY_KEY"` AuthorId int `gorm:"column:author_id"` AuthorUsername string `gorm:"column:author_username"` TargetId int `gorm:"column:target_id"` TargetUsername string `gorm:"column:target_username"` Action AdminActionLogType `gorm:"column:action"` Notes string `gorm:"column:notes"` Timestamp int64 `gorm:"column:timestamp"` }
func (*AdminActionLog) Insert ¶
func (log *AdminActionLog) Insert() error
Insert Inserts an admin action log to the database
func (*AdminActionLog) TableName ¶
func (*AdminActionLog) TableName() string
type AdminActionLogType ¶
type AdminActionLogType string
const ( AdminActionBanned AdminActionLogType = "Banned" AdminActionKicked AdminActionLogType = "Kicked" AdminActionUnmuted AdminActionLogType = "Unmuted" AdminActionUpdated AdminActionLogType = "Updated" )
type Application ¶
type Application struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` UserId int `gorm:"column:user_id" json:"user_id"` Name string `gorm:"column:name" json:"name"` RedirectURL string `gorm:"column:redirect_url" json:"redirect_url"` ClientId string `gorm:"column:client_id" json:"client_id"` ClientSecret string `gorm:"column:client_secret" json:"client_secret,omitempty"` Timestamp int64 `gorm:"column:timestamp" json:"-"` TimestampJSON time.Time `gorm:"-:all" json:"timestamp"` Active bool `gorm:"column:active" json:"active"` }
func GetApplicationById ¶
func GetApplicationById(id int) (*Application, error)
GetApplicationById Retrieves an application by id
func GetUserActiveApplications ¶
func GetUserActiveApplications(userId int) ([]*Application, error)
GetUserActiveApplications Retrieves a user's active applications
func (*Application) BeforeCreate ¶
func (app *Application) BeforeCreate(*gorm.DB) (err error)
func (*Application) SetActiveStatus ¶
func (app *Application) SetActiveStatus(active bool) error
SetActiveStatus Sets an applications active status
func (*Application) SetClientSecret ¶
func (app *Application) SetClientSecret(secret string) error
SetClientSecret Sets a new secret for the application
func (*Application) SetName ¶
func (app *Application) SetName(name string) error
SetName Sets a new name for the application
func (*Application) SetRedirectURL ¶
func (app *Application) SetRedirectURL(url string) error
SetRedirectURL Sets a new redirect url for the application
func (*Application) TableName ¶
func (*Application) TableName() string
type Badge ¶
type Badge struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` Name string `gorm:"column:name" json:"name"` Description string `gorm:"column:description" json:"description"` }
func GetUserBadges ¶
GetUserBadges Retrieves a user's badges from the database
type BoolQuery ¶
type BoolQuery struct { BoolQuery struct { Must []interface{} `json:"must,omitempty"` Should []interface{} `json:"should,omitempty"` Filter []interface{} `json:"filter,omitempty"` MinimumShouldMatch int `json:"minimum_should_match,omitempty"` } `json:"bool,omitempty"` }
type ChatMessage ¶
type ChatMessage struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` SenderId int `gorm:"column:sender_id" json:"sender_id"` Type int8 `gorm:"type" json:"type"` ReceiverId *int `gorm:"receiver_id" json:"receiver_id"` Channel string `gorm:"channel" json:"channel"` Message string `gorm:"message" json:"message"` Timestamp int64 `gorm:"timestamp" json:"-"` TimestampJSON time.Time `gorm:"-:all" json:"timestamp"` IsHidden bool `gorm:"column:hidden" json:"-"` User *User `gorm:"foreignKey:SenderId" json:"user"` }
func GetPrivateChatMessageHistory ¶
func GetPrivateChatMessageHistory(userId int, otherUser int) ([]*ChatMessage, error)
GetPrivateChatMessageHistory Gets the last 50 messages of a private chat
func GetPublicChatMessageHistory ¶
func GetPublicChatMessageHistory(channel string) ([]*ChatMessage, error)
GetPublicChatMessageHistory Gets the last 50 messages of a public chat
func (*ChatMessage) BeforeCreate ¶
func (m *ChatMessage) BeforeCreate(*gorm.DB) (err error)
func (*ChatMessage) TableName ¶
func (*ChatMessage) TableName() string
type Clan ¶
type Clan struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` OwnerId int `gorm:"column:owner_id" json:"owner_id"` Name string `gorm:"column:name" json:"name"` Tag string `gorm:"column:tag" json:"tag"` CreatedAt int64 `gorm:"column:created_at" json:"-"` AboutMe *string `gorm:"column:about_me" json:"about_me"` FavoriteMode uint8 `gorm:"column:favorite_mode" json:"favorite_mode"` LastNameChangeTime int64 `gorm:"column:last_name_change_time" json:"-"` IsCustomizable bool `gorm:"column:customizable" json:"customizable"` CreatedAtJSON time.Time `gorm:"-:all" json:"created_at"` LastNameChangeTimeJSON time.Time `gorm:"-:all" json:"last_name_change_time"` Stats []*ClanStats `gorm:"foreignKey:ClanId" json:"stats"` }
func GetClanById ¶
GetClanById Gets a clan from the database by its id
func GetClanByName ¶
GetClanByName Gets a clan from the database by its name
func GetClanLeaderboardForMode ¶
GetClanLeaderboardForMode Retrieves a clan leaderboard for a given game mode
func (*Clan) UpdateAboutMe ¶
UpdateAboutMe Updates a clan's about me
func (*Clan) UpdateCustomizable ¶
UpdateCustomizable Updates a clan's customizability status
func (*Clan) UpdateFavoriteMode ¶
UpdateFavoriteMode Updates the favorite mode of a clan
func (*Clan) UpdateName ¶
UpdateName Updates the name of a clan
func (*Clan) UpdateOwner ¶
UpdateOwner Updates the owner of a clan
type ClanActivity ¶
type ClanActivity struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` ClanId int `gorm:"column:clan_id" json:"clan_id"` Type ClanActivityType `gorm:"column:type" json:"type"` UserId int `gorm:"column:user_id" json:"user_id"` MapId int `gorm:"column:map_id" json:"map_id"` Message string `gorm:"column:message" json:"message"` Timestamp int64 `gorm:"column:timestamp" json:"-"` TimestampJSON time.Time `gorm:"-:all" json:"timestamp"` User *User `gorm:"foreignKey:UserId" json:"user"` }
func GetClanActivity ¶
func GetClanActivity(clanId int, limit int, page int) ([]*ClanActivity, error)
GetClanActivity Retrieves clan activity from the database
func NewClanActivity ¶
func NewClanActivity(clanId int, activityType ClanActivityType, userId int) *ClanActivity
NewClanActivity Creates a new clan activity
func (*ClanActivity) BeforeCreate ¶
func (a *ClanActivity) BeforeCreate(*gorm.DB) (err error)
func (*ClanActivity) Insert ¶
func (a *ClanActivity) Insert() error
Insert Inserts a clan activity into the database
func (*ClanActivity) TableName ¶
func (*ClanActivity) TableName() string
type ClanActivityType ¶
type ClanActivityType int8
const ( ClanActivityNone ClanActivityType = iota ClanActivityCreated ClanActivityUserJoined ClanActivityUserLeft ClanActivityUserKicked ClanActivityOwnershipTransferred )
type ClanInvite ¶
type ClanInvite struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` ClanId int `gorm:"column:clan_id" json:"clan_id"` UserId int `gorm:"column:user_id" json:"user_id"` CreatedAt int64 `gorm:"column:created_at" json:"-"` CreatedAtJSON time.Time `gorm:"-:all" json:"created_at"` Clan *Clan `gorm:"foreignKey:ClanId" json:"clan,omitempty"` User *User `gorm:"foreignKey:UserId" json:"user,omitempty"` }
func GetClanInviteById ¶
func GetClanInviteById(id int) (*ClanInvite, error)
GetClanInviteById GetClanInvite Retrieves a clan invite at a specific id
func GetPendingClanInvite ¶
func GetPendingClanInvite(clanId int, userId int) (*ClanInvite, error)
GetPendingClanInvite Retrieves a clan invite for a given user
func GetPendingClanInvites ¶
func GetPendingClanInvites(clanId int) ([]*ClanInvite, error)
GetPendingClanInvites Gets all of a clan's pending invites
func GetUserClanInvites ¶
func GetUserClanInvites(userId int) ([]*ClanInvite, error)
GetUserClanInvites Retrieves a list of pending clan invites for the user
func InviteUserToClan ¶
func InviteUserToClan(clanId int, userId int) (*ClanInvite, error)
InviteUserToClan Creates a clan invite for a user
func (*ClanInvite) BeforeCreate ¶
func (invite *ClanInvite) BeforeCreate(*gorm.DB) (err error)
func (*ClanInvite) TableName ¶
func (*ClanInvite) TableName() string
type ClanScore ¶
type ClanScore struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` ClanId int `gorm:"column:clan_id" json:"-"` MapMD5 string `gorm:"column:map_md5" json:"-"` Mode enums.GameMode `gorm:"column:mode" json:"-"` OverallRating float64 `gorm:"column:overall_rating" json:"overall_rating"` OverallAccuracy float64 `gorm:"column:overall_accuracy" json:"overall_accuracy"` Timestamp int64 `gorm:"column:timestamp" json:"-"` TimestampJSON time.Time `gorm:"-:all" json:"timestamp"` Map *MapQua `gorm:"foreignKey:MapMD5; references:MD5" json:"map,omitempty"` Clan *Clan `gorm:"foreignKey:ClanId; references:Id" json:"clan,omitempty"` }
func CalculateClanScore ¶
CalculateClanScore Calculates a clan score for a given map
func GetClanScore ¶
GetClanScore Retrieves an existing clan score
func GetClanScoreById ¶
GetClanScoreById Retrieves a clan score by id
func GetClanScoreboardForMap ¶
GetClanScoreboardForMap Retrieves the clan scoreboard for a given map
func GetClanScoresForMode ¶
GetClanScoresForMode Retrieves all clan scores for a given mode
func GetClanScoresForModeFull ¶
GetClanScoresForModeFull Retrieves clan scores with full data
type ClanStats ¶
type ClanStats struct { ClanId int `gorm:"column:clan_id" json:"-"` Mode enums.GameMode `gorm:"column:mode" json:"mode"` Rank int `gorm:"-:all" json:"rank"` OverallAccuracy float64 `gorm:"column:overall_accuracy" json:"overall_accuracy"` OverallPerformanceRating float64 `gorm:"column:overall_performance_rating" json:"overall_performance_rating"` TotalMarv int `gorm:"column:total_marv" json:"total_marv"` TotalPerf int `gorm:"column:total_perf" json:"total_perf"` TotalGreat int `gorm:"column:total_great" json:"total_great"` TotalGood int `gorm:"column:total_good" json:"total_good"` TotalOkay int `gorm:"column:total_okay" json:"total_okay"` TotalMiss int `gorm:"column:total_miss" json:"total_miss"` }
func GetClanStatsByMode ¶
GetClanStatsByMode Retrieves clan stats by its game mode
type CrashLog ¶
type ElasticHits ¶
type ElasticHits struct { Hits struct { Hits []struct { InnerHits struct { MostRelevant struct { Hits struct { Hits []struct { Source ElasticMap `json:"_source"` } `json:"hits"` } `json:"hits"` } `json:"most_relevant"` } `json:"inner_hits"` } `json:"hits"` } `json:"hits"` Aggregations struct { Distinct struct { Total int `json:"value"` } `json:"distinct_mapset_ids"` } `json:"aggregations"` }
type ElasticMap ¶
type ElasticMapsetSearchOptions ¶
type ElasticMapsetSearchOptions struct { Search string `form:"search" json:"search"` RankedStatus []enums.RankedStatus `form:"ranked_status" json:"ranked_status"` RankedStatusArray []enums.RankedStatus `form:"ranked_status[]" json:"ranked_status[]"` Mode []enums.GameMode `form:"mode" json:"mode"` ModeArray []enums.GameMode `form:"mode[]" json:"mode[]"` Page int `form:"page" json:"page"` Limit int `form:"limit" json:"limit"` MinDifficultyRating float64 `form:"min_difficulty_rating" json:"min_difficulty_rating"` MaxDifficultyRating float64 `form:"max_difficulty_rating" json:"max_difficulty_rating"` MinBPM float32 `form:"min_bpm" json:"min_bpm"` MaxBPM float32 `form:"max_bpm" json:"max_bpm"` MinLength float32 `form:"min_length" json:"min_length"` MaxLength float32 `form:"max_length" json:"max_length"` MinLongNotePercent float32 `form:"min_long_note_percent" json:"min_long_note_percent"` MaxLongNotePercent float32 `form:"max_long_note_percent" json:"max_long_note_percent"` MinPlayCount int64 `form:"min_play_count" json:"min_play_count"` MaxPlayCount int64 `form:"max_play_count" json:"max_play_count"` MinCombo int64 `form:"min_combo" json:"min_combo"` MaxCombo int64 `form:"max_combo" json:"max_combo"` MinDateSubmitted int64 `form:"min_date_submitted" json:"min_date_submitted"` MaxDateSubmitted int64 `form:"max_date_submitted" json:"max_date_submitted"` MinLastUpdated int64 `form:"min_last_updated" json:"min_last_updated"` MaxLastUpdated int64 `form:"max_last_updated" json:"max_last_updated"` Explicit bool `form:"show_explicit" json:"show_explicit"` }
func NewElasticMapsetSearchOptions ¶
func NewElasticMapsetSearchOptions() *ElasticMapsetSearchOptions
func (*ElasticMapsetSearchOptions) BindAndValidate ¶
func (options *ElasticMapsetSearchOptions) BindAndValidate()
type GameBuild ¶
type GameBuild struct { Id int `gorm:"column:id; PRIMARY_KEY"` Version string `gorm:"column:version"` QuaverDll string `gorm:"column:quaver_dll"` QuaverApiDll string `gorm:"column:quaver_api_dll"` QuaverServerClientDll string `gorm:"column:quaver_server_client_dll"` QuaverServerCommonDll string `gorm:"column:quaver_server_common_dll"` Allowed bool `gorm:"column:allowed"` Timestamp int64 `gorm:"column:timestamp"` }
type MapMod ¶
type MapMod struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` MapId int `gorm:"column:map_id" json:"map_id"` AuthorId int `gorm:"column:author_id" json:"author_id"` Timestamp int64 `gorm:"column:timestamp" json:"-"` TimestampJSON time.Time `gorm:"-:all" json:"timestamp"` MapTimestamp *string `gorm:"column:map_timestamp" json:"map_timestamp"` Comment string `gorm:"column:comment" json:"comment"` Status MapModStatus `gorm:"column:status" json:"status"` Type MapModType `gorm:"column:type" json:"type"` Author *User `gorm:"foreignKey:AuthorId; references:Id" json:"author"` Replies []*MapModComment `gorm:"foreignKey:MapModId" json:"replies"` }
func GetMapMods ¶
GetMapMods Retrieves map mods for a given map
func (*MapMod) UpdateStatus ¶
func (mod *MapMod) UpdateStatus(status MapModStatus) error
UpdateStatus Updates the status of a map mod
type MapModComment ¶
type MapModComment struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` MapModId int `gorm:"column:map_mod_id" json:"map_mod_id"` AuthorId int `gorm:"column:author_id" json:"author_id"` Timestamp int64 `gorm:"column:timestamp" json:"-"` TimestampJSON time.Time `gorm:"-:all" json:"timestamp"` Comment string `gorm:"column:comment" json:"comments"` Spam bool `gorm:"column:spam" json:"spam"` Author *User `gorm:"foreignKey:AuthorId; references:Id" json:"author"` }
func (*MapModComment) Insert ¶
func (comment *MapModComment) Insert() error
Insert Inserts a new mod comment into the database
func (*MapModComment) TableName ¶
func (*MapModComment) TableName() string
type MapModStatus ¶
type MapModStatus string
type MapModType ¶
type MapModType string
type MapQua ¶
type MapQua struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` MapsetId int `gorm:"column:mapset_id" json:"mapset_id"` MD5 string `gorm:"column:md5" json:"md5"` AlternativeMD5 string `gorm:"column:alternative_md5" json:"alternative_md5"` CreatorId int `gorm:"column:creator_id" json:"creator_id"` CreatorUsername string `gorm:"column:creator_username" json:"creator_username"` GameMode enums.GameMode `gorm:"column:game_mode" json:"game_mode"` RankedStatus enums.RankedStatus `gorm:"column:ranked_status" json:"ranked_status"` Artist string `gorm:"column:artist" json:"artist"` Title string `gorm:"column:title" json:"title"` Source string `gorm:"column:source" json:"source"` Tags string `gorm:"column:tags" json:"tags"` Description string `gorm:"column:description" json:"description"` DifficultyName string `gorm:"column:difficulty_name" json:"difficulty_name"` Length int `gorm:"column:length" json:"length"` BPM float32 `gorm:"column:bpm" json:"bpm"` DifficultyRating float64 `gorm:"column:difficulty_rating" json:"difficulty_rating"` CountHitObjectNormal int `gorm:"column:count_hitobject_normal" json:"count_hitobject_normal"` CountHitObjectLong int `gorm:"column:count_hitobject_long" json:"count_hitobject_long"` LongNotePercentage float32 `gorm:"-:all" json:"long_note_percentage"` MaxCombo int `gorm:"-:all" json:"max_combo"` PlayCount int `gorm:"column:play_count" json:"play_count"` FailCount int `gorm:"column:fail_count" json:"fail_count"` PlayAttempts int `gorm:"-:all" json:"play_attempts"` ModsPending int `gorm:"column:mods_pending" json:"mods_pending"` ModsAccepted int `gorm:"column:mods_accepted" json:"mods_accepted"` ModsDenied int `gorm:"column:mods_denied" json:"mods_denied"` ModsIgnored int `gorm:"column:mods_ignored" json:"mods_ignored"` OnlineOffset int `gorm:"column:online_offset" json:"online_offset"` IsClanRanked bool `gorm:"column:clan_ranked" json:"is_clan_ranked"` }
func GetMapById ¶
GetMapById Retrieves a map from the database by id
func GetMapByMD5 ¶
GetMapByMD5 Retrieves a map from the database by md5
func GetMapByMD5AndAlternative ¶
GetMapByMD5AndAlternative Retrieves a map from the database by either its md5 or alternative md5
type Mapset ¶
type Mapset struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` PackageMD5 string `gorm:"column:package_md5" json:"package_md5"` CreatorID int `gorm:"column:creator_id" json:"creator_id"` CreatorUsername string `gorm:"column:creator_username" json:"creator_username"` Artist string `gorm:"column:artist" json:"artist"` Title string `gorm:"column:title" json:"title"` Source string `gorm:"column:source" json:"source"` Tags string `gorm:"column:tags" json:"tags"` Description string `gorm:"column:description" json:"description"` DateSubmitted int64 `gorm:"column:date_submitted" json:"-"` DateSubmittedJSON time.Time `gorm:"-:all" json:"date_submitted"` DateLastUpdated int64 `gorm:"column:date_last_updated" json:"-"` DateLastUpdatedJSON time.Time `gorm:"-:all" json:"date_last_updated"` IsVisible bool `gorm:"column:visible" json:"is_visible"` IsExplicit bool `gorm:"column:explicit" json:"is_explicit"` Maps []*MapQua `gorm:"foreignKey:MapsetId" json:"maps,omitempty"` User *User `gorm:"foreignKey:CreatorID; references:Id" json:"user,omitempty"` }
func GetAllMapsets ¶
GetAllMapsets Retrieves all the mapsets in the database
func GetMapsetById ¶
GetMapsetById Retrieves a mapset by its id
func GetUserMapsets ¶
GetUserMapsets Retrieves a user's uploaded mapsets
func GetUserMonthlyUploadMapsets ¶
GetUserMonthlyUploadMapsets Retrieves a user's mapsets that they've uploaded in the past month
func SearchElasticMapsets ¶
func SearchElasticMapsets(options *ElasticMapsetSearchOptions) ([]*Mapset, int, error)
SearchElasticMapsets Searches ElasticSearch for mapsets
func (*Mapset) UpdateExplicit ¶
UpdateExplicit Sets the explicit state of the mapset
func (*Mapset) UpdateMetadata ¶
UpdateMetadata Updates the metadata of a given mapset (username, artist, title, etc)
type MapsetDownload ¶
type MapsetDownload struct { Id int `gorm:"column:id; PRIMARY_KEY"` UserId int `gorm:"column:user_id"` MapsetId int `gorm:"column:mapset_id"` Timestamp int64 `gorm:"column:timestamp"` Method string `gorm:"column:method"` }
func (*MapsetDownload) TableName ¶
func (*MapsetDownload) TableName() string
type MapsetDownloadMethod ¶
type MapsetDownloadMethod int8
const ( DownloadMethodWeb MapsetDownloadMethod = iota DownloadMethodInGame )
type MapsetRankingQueueComment ¶
type MapsetRankingQueueComment struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` UserId int `gorm:"column:user_id" json:"user_id"` MapsetId int `gorm:"column:mapset_id" json:"mapset_id"` ActionType RankingQueueAction `gorm:"action_type" json:"action_type"` IsActive bool `gorm:"is_active" json:"is_active"` // If action counts toward ranking Timestamp int64 `gorm:"column:timestamp" json:"-"` TimestampJSON time.Time `gorm:"-:all" json:"timestamp"` Comment string `gorm:"comment" json:"comment"` DateLastUpdated int64 `gorm:"date_last_updated" json:"-"` DateLastUpdatedJSON time.Time `gorm:"-:all" json:"date_last_updated"` User *User `gorm:"foreignKey:UserId; references:Id" json:"user,omitempty"` }
func GetRankingQueueComment ¶
func GetRankingQueueComment(id int) (*MapsetRankingQueueComment, error)
GetRankingQueueComment Retrieves a ranking queue comment at a given id
func GetRankingQueueComments ¶
func GetRankingQueueComments(mapsetId int) ([]*MapsetRankingQueueComment, error)
GetRankingQueueComments Retrieves the ranking queue comments for a given mapset
func GetRankingQueueDenies ¶
func GetRankingQueueDenies(mapsetId int) ([]*MapsetRankingQueueComment, error)
GetRankingQueueDenies Retrieves the active denies for a given mapset in the ranking queue
func GetRankingQueueVotes ¶
func GetRankingQueueVotes(mapsetId int) ([]*MapsetRankingQueueComment, error)
GetRankingQueueVotes Retrieves the active votes for a given mapset in the ranking queue
func GetUserRankingQueueComments ¶
func GetUserRankingQueueComments(userId int, timeStart int64, timeEnd int64) ([]*MapsetRankingQueueComment, error)
GetUserRankingQueueComments Retrieves a user's ranking queue comments between two times
func (*MapsetRankingQueueComment) AfterFind ¶
func (c *MapsetRankingQueueComment) AfterFind(*gorm.DB) (err error)
func (*MapsetRankingQueueComment) Edit ¶
func (c *MapsetRankingQueueComment) Edit(comment string) error
Edit Edits the content of a ranking queue comment
func (*MapsetRankingQueueComment) Insert ¶
func (c *MapsetRankingQueueComment) Insert() error
Insert Inserts a ranking queue comment into the database
func (*MapsetRankingQueueComment) TableName ¶
func (*MapsetRankingQueueComment) TableName() string
type MultiplayerGame ¶
type MultiplayerGame struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` UniqueId string `gorm:"column:unique_id" json:"unique_id"` Name string `gorm:"column:name" json:"name"` Type int8 `gorm:"column:type" json:"-"` TimeCreated int64 `gorm:"time_created" json:"-"` TimeCreatedJSON time.Time `gorm:"-:all" json:"time_created"` Matches []*MultiplayerGameMatches `gorm:"foreignKey:GameId" json:"matches"` }
func GetMultiplayerGame ¶
func GetMultiplayerGame(id int) (*MultiplayerGame, error)
GetMultiplayerGame Gets an individual multiplayer game from the database
func GetRecentMultiplayerGames ¶
func GetRecentMultiplayerGames(limit int, page int) ([]*MultiplayerGame, error)
GetRecentMultiplayerGames Retrieves recently played multiplayer games from the DB
func (*MultiplayerGame) TableName ¶
func (*MultiplayerGame) TableName() string
type MultiplayerGameMatches ¶
type MultiplayerGameMatches struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` GameId int `gorm:"column:game_id" json:"game_id"` TimePlayed int64 `gorm:"column:time_played" json:"-"` TimePlayedJSON time.Time `gorm:"-:all" json:"time_played"` MapMD5 string `gorm:"column:map_md5" json:"map_md5"` MapString string `gorm:"column:map" json:"map_string"` HostId int `gorm:"column:host_id" json:"host_id"` Ruleset int8 `gorm:"column:ruleset" json:"-"` GameMode enums.GameMode `gorm:"column:game_mode" json:"game_mode"` GlobalModifiers int64 `gorm:"column:global_modifiers" json:"global_modifiers"` FreeModType int8 `gorm:"column:free_mod_type" json:"free_mod_type"` HealthType int8 `gorm:"column:health_type" json:"-"` Lives int `gorm:"column:lives" json:"-"` Aborted bool `gorm:"column:aborted" json:"aborted"` Map *MapQua `gorm:"foreignKey:MapMD5; references:MD5" json:"map"` Scores []*MultiplayerMatchScore `gorm:"foreignKey:MatchId;" json:"scores,omitempty"` }
func (*MultiplayerGameMatches) TableName ¶
func (*MultiplayerGameMatches) TableName() string
type MultiplayerMapShare ¶
type MultiplayerMapShare struct {}
func (*MultiplayerMapShare) Insert ¶
func (m *MultiplayerMapShare) Insert() error
func (*MultiplayerMapShare) MarshalBinary ¶
func (m *MultiplayerMapShare) MarshalBinary() (data []byte, err error)
func (*MultiplayerMapShare) PublishToRedis ¶
func (m *MultiplayerMapShare) PublishToRedis() error
func (*MultiplayerMapShare) TableName ¶
func (*MultiplayerMapShare) TableName() string
func (*MultiplayerMapShare) UnmarshalBinary ¶
func (m *MultiplayerMapShare) UnmarshalBinary(data []byte) error
type MultiplayerMatchScore ¶
type MultiplayerMatchScore struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` UserId int `gorm:"column:user_id" json:"user_id"` MatchId int `gorm:"column:match_id" json:"match_id"` Team int8 `gorm:"column:team" json:"-"` Modifiers int64 `gorm:"column:mods" json:"modifiers"` PerformanceRating float64 `gorm:"column:performance_rating" json:"performance_rating"` Score int `gorm:"column:score" json:"-"` Accuracy float64 `gorm:"column:accuracy" json:"accuracy"` MaxCombo int `gorm:"column:max_combo" json:"max_combo"` CountMarvelous int `gorm:"column:count_marv" json:"count_marvelous"` CountPerfect int `gorm:"column:count_perf" json:"count_perfect"` CountGreat int `gorm:"column:count_great" json:"count_great"` CountGood int `gorm:"column:count_good" json:"count_good"` CountOkay int `gorm:"column:count_okay" json:"count_okay"` CountMiss int `gorm:"column:count_miss" json:"count_miss"` FullCombo bool `gorm:"column:full_combo" json:"-"` LivesLeft int `gorm:"column:lives_left" json:"-"` HasFailed bool `gorm:"column:has_failed" json:"-"` Won bool `gorm:"column:won" json:"won"` BattleRoyalePlace int `gorm:"column:battle_royale_place" json:"-"` User *User `gorm:"foreignKey:UserId; references:Id" json:"user"` }
func (*MultiplayerMatchScore) TableName ¶
func (*MultiplayerMatchScore) TableName() string
type Order ¶
type Order struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` UserId int `gorm:"column:user_id" json:"user_id"` OrderId int `gorm:"column:order_id" json:"-"` TransactionId string `gorm:"column:transaction_id" json:"-"` IPAddress string `gorm:"column:ip_address" json:"-"` ItemId OrderItemId `gorm:"column:item_id" json:"item_id"` Quantity int `gorm:"column:quantity" json:"quantity"` Amount float32 `gorm:"column:amount" json:"amount"` Description string `gorm:"column:description" json:"description"` ReceiverUserId int `gorm:"column:gifted_to" json:"-"` Receiver *User `gorm:"foreignKey:ReceiverUserId" json:"receiver"` Timestamp int64 `gorm:"column:timestamp" json:"-"` TimestampJSON time.Time `gorm:"-:all" json:"timestamp"` Status OrderStatus `gorm:"column:status" json:"status"` SubscriptionId *int `gorm:"column:subscription_id" json:"-"` Item *OrderItem `gorm:"foreignKey:ItemId" json:"item"` Subscription *OrderSubscriptionStripe `gorm:"foreignKey:SubscriptionId" json:"subscription,omitempty"` }
func GetSteamOrdersByIds ¶
GetSteamOrdersByIds Retrieves orders by their steam order id & transaction id. Multiple orders in the database can have them if a user has multiple items in their cart.
func GetStripeOrderById ¶
GetStripeOrderById Gets Stripe orders by id
func GetUserOrders ¶
GetUserOrders Gets a user's orders
func (*Order) FinalizeBadge ¶
FinalizeBadge Finalizes a badge order
func (*Order) FinalizeClanCustomizable ¶
FinalizeClanCustomizable Finalizes a clan customizable access order
func (*Order) FinalizeDonator ¶
FinalizeDonator Finalizes a donator item
func (*Order) SetReceiver ¶
SetReceiver Sets the receiver of the order. Checks if the user they are attempting to gift to exist. Returns if the receiver was successfully set and if there was a db error
type OrderItem ¶
type OrderItem struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` StripePriceId string `gorm:"column:stripe_price_id" json:"-"` Category OrderItemCategory `gorm:"column:category" json:"category"` Name string `gorm:"column:name" json:"name"` PriceSteam int `gorm:"column:price_steam" json:"price_steam"` PriceStripe int `gorm:"column:price_stripe" json:"price_stripe"` MaxQuantityAllowed int `gorm:"column:max_qty_allowed" json:"max_qty_allowed"` DonatorBundleItem bool `gorm:"column:donator_bundle_item" json:"donator_bundle_item"` InStock bool `gorm:"column:in_stock" json:"in_stock"` CanGift bool `gorm:"column:can_gift" json:"can_gift"` Visible bool `gorm:"column:visible" json:"visible"` BadgeId *int `gorm:"column:badge_id" json:"badge_id,omitempty"` }
func GetOrderItemById ¶
GetOrderItemById Retrieves an order item from the database by id
type OrderItemCategory ¶
type OrderItemCategory int8
const ( OrderItemCategoryDonator OrderItemCategory = iota OrderItemCategoryBadge OrderItemCategoryClan )
type OrderItemId ¶
type OrderItemId int
const ( OrderItemDonator OrderItemId = iota + 1 OrderItemClanCustomizable )
type OrderStatus ¶
type OrderStatus string
const ( OrderStatusWaiting OrderStatus = "Waiting" OrderStatusCompleted OrderStatus = "Completed" )
type OrderSubscriptionStripe ¶
type OrderSubscriptionStripe struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` UserId int `gorm:"column:user_id" json:"user_id" json:"-"` StripeCustomerId string `gorm:"column:customer_id" json:"stripe_customer_id"` StripeSubscriptionId string `gorm:"column:subscription_id" json:"stripe_subscription_id"` TimeCreated int64 `gorm:"time_created" json:"-"` TimeLastUpdated int64 `gorm:"time_last_updated" json:"-"` IsActive bool `gorm:"column:is_active" json:"-"` }
func GetOrderSubscriptionById ¶
func GetOrderSubscriptionById(subscriptionId string) (*OrderSubscriptionStripe, error)
GetOrderSubscriptionById Retrieves a subscription by id
func GetUserActiveSubscriptions ¶
func GetUserActiveSubscriptions(userId int) ([]*OrderSubscriptionStripe, error)
GetUserActiveSubscriptions Retrieves a user's active stripe subscriptions
func (*OrderSubscriptionStripe) Insert ¶
func (sub *OrderSubscriptionStripe) Insert() error
func (*OrderSubscriptionStripe) TableName ¶
func (*OrderSubscriptionStripe) TableName() string
func (*OrderSubscriptionStripe) UpdateActiveState ¶
func (sub *OrderSubscriptionStripe) UpdateActiveState(isActive bool) error
UpdateActiveState Sets the active state of the subscription
type PinnedScore ¶
type PinnedScore struct { UserId int `gorm:"column:user_id" json:"user_id"` GameMode enums.GameMode `gorm:"column:game_mode" json:"game_mode"` ScoreId int `gorm:"column:score_id" json:"score_id"` SortOrder int `gorm:"column:sort_order" json:"sort_order"` Score *Score `gorm:"foreignKey:ScoreId; references:Id" json:"score"` }
func GetUserPinnedScores ¶
func GetUserPinnedScores(userId int, mode enums.GameMode) ([]*PinnedScore, error)
GetUserPinnedScores Retrieves a user's pinned scores
func (*PinnedScore) Insert ¶
func (ps *PinnedScore) Insert() error
func (*PinnedScore) TableName ¶
func (*PinnedScore) TableName() string
type Playlist ¶
type Playlist struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` UserId int `gorm:"column:user_id" json:"-"` User *User `gorm:"foreignKey:UserId" json:"user,omitempty"` Name string `gorm:"column:name" json:"name"` Description string `gorm:"column:description" json:"description"` LikeCount int `gorm:"column:like_count" json:"-"` MapCount int `gorm:"column:map_count" json:"map_count"` Timestamp int64 `gorm:"column:timestamp" json:"-"` TimestampJSON time.Time `gorm:"-:all" json:"timestamp"` TimeLastUpdated int64 `gorm:"column:time_last_updated" json:"-"` TimeLastUpdatedJSON time.Time `gorm:"-:all" json:"time_last_updated"` Visible bool `gorm:"column:visible" json:"-"` Mapsets []*PlaylistMapset `gorm:"foreignKey:PlaylistId" json:"mapsets,omitempty"` Maps []*PlaylistMap `gorm:"foreignKey:PlaylistId" json:"-"` // Only used for migration }
func GetAllPlaylists ¶
GetAllPlaylists Returns all the playlists in the db
func GetPlaylist ¶
GetPlaylist Gets an individual playlist without mapset data
func GetPlaylistFull ¶
GetPlaylistFull Gets an individual playlist with mapsets/maps included
func GetUserPlaylists ¶
GetUserPlaylists Gets a user's created playlists
func SearchPlaylists ¶
SearchPlaylists Returns playlists that meet a particular search query
func (*Playlist) UpdateDescription ¶
UpdateDescription Updates the description of a playlist
func (*Playlist) UpdateName ¶
UpdateName Updates the name of a playlist
func (*Playlist) UpdateVisibility ¶
UpdateVisibility Updates the visibility of a playlist
type PlaylistMap ¶
type PlaylistMap struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"playlist_map_id"` PlaylistId int `gorm:"column:playlist_id" json:"-"` MapId int `gorm:"column:map_id" json:"-"` PlaylistsMapsetId int `gorm:"column:playlists_mapsets_id" json:"-"` Map *MapQua `gorm:"foreignKey:MapId" json:"map"` }
func (*PlaylistMap) Insert ¶
func (pm *PlaylistMap) Insert() error
Insert Inserts a playlist map into the db
func (*PlaylistMap) TableName ¶
func (*PlaylistMap) TableName() string
func (*PlaylistMap) UpdateMapsetId ¶
func (pm *PlaylistMap) UpdateMapsetId(playlistMapsetId int) error
UpdateMapsetId Updates the PLAYLIST mapset id for a playlist
type PlaylistMapset ¶
type PlaylistMapset struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"playlist_mapset_id"` PlaylistId int `gorm:"column:playlist_id" json:"-"` MapsetId int `gorm:"column:mapset_id" json:"-"` Mapset *Mapset `gorm:"foreignKey:MapsetId" json:"mapset"` Maps []*PlaylistMap `gorm:"foreignKey:PlaylistsMapsetId" json:"maps"` }
func GetPlaylistMapsetByIds ¶
func GetPlaylistMapsetByIds(playlistId int, mapsetId int) (*PlaylistMapset, error)
GetPlaylistMapsetByIds Gets a playlist mapset by its playlist id and mapset id
func GetPlaylistMapsetsByMapsetId ¶
func GetPlaylistMapsetsByMapsetId(mapsetId int) ([]*PlaylistMapset, error)
GetPlaylistMapsetsByMapsetId Gets all the playlist mapsets that have a particular mapset id
func (*PlaylistMapset) Insert ¶
func (pm *PlaylistMapset) Insert() error
Insert Inserts a playlist mapset into the db
func (*PlaylistMapset) TableName ¶
func (*PlaylistMapset) TableName() string
type QueryString ¶
type QueryString struct { QueryString struct { Query string `json:"query"` Fields []string `json:"fields"` DefaultOperator string `json:"default_operator"` Boost float64 `json:"boost"` } `json:"query_string"` }
func NewQueryString ¶
func NewQueryString(query string, fields []string, defaultOperator string, boost float64) QueryString
type Range ¶
type Range struct { Gte interface{} `json:"gte,omitempty"` Lte interface{} `json:"lte,omitempty"` Boost interface{} `json:"boost,omitempty"` }
type RangeCustom ¶
type RankingQueueAction ¶
type RankingQueueAction int8
const ( RankingQueueActionComment RankingQueueAction = iota RankingQueueActionDeny RankingQueueActionBlacklist RankingQueueActionOnHold RankingQueueActionVote RankingQueueActionResolved )
type RankingQueueMapset ¶
type RankingQueueMapset struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` MapsetId int `gorm:"column:mapset_id" json:"mapset_id"` Timestamp int64 `gorm:"column:timestamp" json:"-"` CreatedAtJSON time.Time `gorm:"-:all" json:"created_at"` // Same value as Timestamp DateLastUpdated int64 `gorm:"column:date_last_updated" json:"-"` LastUpdatedJSON time.Time `gorm:"-:all" json:"last_updated"` // Same value as DateLastUpdated Status RankingQueueStatus `gorm:"column:status" json:"status"` NeedsAttention bool `gorm:"column:needs_attention" json:"-"` VoteCount int `gorm:"-:all" json:"-"` Mapset *Mapset `gorm:"foreignKey:MapsetId; references:Id" json:"mapset"` Votes []*MapsetRankingQueueComment `gorm:"-:all" json:"votes"` Denies []*MapsetRankingQueueComment `gorm:"-:all" json:"denies"` Comments []*MapsetRankingQueueComment `gorm:"foreignKey:MapsetId; references:MapsetId" json:"-"` }
func GetRankingQueue ¶
GetRankingQueue Retrieves the ranking queue for a given game mode
func GetRankingQueueMapset ¶
func GetRankingQueueMapset(mapsetId int) (*RankingQueueMapset, error)
GetRankingQueueMapset Retrieves a ranking queue mapset for a given mapset id
func GetUserMapsetsInRankingQueue ¶
func GetUserMapsetsInRankingQueue(userId int) ([]*RankingQueueMapset, error)
GetUserMapsetsInRankingQueue Retrieves the mapsets the user has in the ranking queue
func (*RankingQueueMapset) AfterFind ¶
func (mapset *RankingQueueMapset) AfterFind(*gorm.DB) (err error)
func (*RankingQueueMapset) Insert ¶
func (mapset *RankingQueueMapset) Insert() error
Insert Inserts a mapset into the ranking queue
func (*RankingQueueMapset) TableName ¶
func (*RankingQueueMapset) TableName() string
func (*RankingQueueMapset) UpdateStatus ¶
func (mapset *RankingQueueMapset) UpdateStatus(status RankingQueueStatus) error
UpdateStatus Updates the status of a ranking queue mapset
func (*RankingQueueMapset) UpdateVoteCount ¶
func (mapset *RankingQueueMapset) UpdateVoteCount(votes int) error
UpdateVoteCount Updates the vote count of a ranking queue mapset
type RankingQueueStatus ¶
type RankingQueueStatus int8
const ( RankingQueuePending RankingQueueStatus = iota RankingQueueDenied RankingQueueBlacklisted RankingQueueOnHold RankingQueueResolved RankingQueueRanked )
type RedisScore ¶
type RedisScore struct { Map struct { Id int `json:"id"` MD5 string `json:"md5"` GameMode enums.GameMode `json:"game_mode"` RankedStatus enums.RankedStatus `json:"ranked_status"` DifficultyRating float64 `json:"difficulty_rating"` ClanRanked bool `json:"clan_ranked"` CountHitobjectNormal int `json:"count_hitobject_normal"` CountHitobjectLong int `json:"count_hitobject_long"` } `json:"map"` Score struct { Id int `json:"id"` PerformanceRating float64 `json:"performance_rating"` PersonalBest bool `json:"personal_best"` Failed bool `json:"failed"` Accuracy float64 `json:"accuracy"` CountMarvelous int `json:"count_marvelous"` CountPerfect int `json:"count_perfect"` CountGreat int `json:"count_great"` CountGood int `json:"count_good"` CountOkay int `json:"count_okay"` CountMiss int `json:"count_miss"` } `json:"score"` User struct { Id int `json:"id"` Username string `json:"username"` Country string `json:"country"` ShadowBanned bool `json:"shadow_banned"` ClanId int `json:"clan_id"` } `json:"user"` }
type Score ¶
type Score struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` UserId int `gorm:"column:user_id" json:"user_id"` MapMD5 string `gorm:"column:map_md5" json:"map_md5"` ReplayMD5 string `gorm:"column:replay_md5" json:"replay_md5"` Mode enums.GameMode `gorm:"column:mode" json:"mode"` Timestamp int64 `gorm:"column:timestamp" json:"-"` TimestampJSON time.Time `gorm:"-:all" json:"timestamp"` IsPersonalBest bool `gorm:"column:personal_best" json:"is_personal_best"` PerformanceRating float64 `gorm:"column:performance_rating" json:"performance_rating"` Modifiers int64 `gorm:"column:mods" json:"modifiers"` Failed bool `gorm:"column:failed" json:"failed"` TotalScore int `gorm:"column:total_score" json:"total_score"` Accuracy float64 `gorm:"column:accuracy" json:"accuracy"` MaxCombo int `gorm:"column:max_combo" json:"max_combo"` CountMarvelous int `gorm:"column:count_marv" json:"count_marvelous"` CountPerfect int `gorm:"column:count_perf" json:"count_perfect"` CountGreat int `gorm:"column:count_great" json:"count_great"` CountGood int `gorm:"column:count_good" json:"count_good"` CountOkay int `gorm:"column:count_okay" json:"count_okay"` CountMiss int `gorm:"column:count_miss" json:"count_miss"` Grade string `gorm:"column:grade" json:"grade"` ScrollSpeed int `gorm:"column:scroll_speed" json:"scroll_speed"` TimePlayStart int64 `gorm:"column:time_play_start" json:"-"` TimePlayEnd int64 `gorm:"column:time_play_end" json:"-"` IP string `gorm:"column:ip" json:"-"` ExecutingAssembly string `gorm:"column:executing_assembly" json:"-"` EntryAssembly string `gorm:"column:entry_assembly" json:"-"` QuaverVersion string `gorm:"column:quaver_version" json:"-"` PauseCount int `gorm:"column:pause_count" json:"-"` PerformanceProcessorVersion string `gorm:"column:performance_processor_version" json:"-"` DifficultyProcessorVersion string `gorm:"column:difficulty_processor_version" json:"-"` IsDonatorScore bool `gorm:"column:is_donator_score" json:"is_donator_score"` TournamentGameId *int `gorm:"column:tournament_game_id" json:"tournament_game_id"` ClanId *int `gorm:"column:clan_id" json:"clan_id"` Map *MapQua `gorm:"foreignKey:MapMD5; references:MD5" json:"map,omitempty"` User *User `gorm:"foreignKey:UserId; references:Id" json:"user,omitempty"` FirstPlace *ScoreFirstPlace `gorm:"foreignKey:Id; references:ScoreId" json:"-"` }
func GetAllScoresForMap ¶
GetAllScoresForMap Retrieves all scores for a map
func GetClanPlayerScoresOnMap ¶
GetClanPlayerScoresOnMap Fetches the top 10 scores from a clan on a given map
func GetCountryScoresForMap ¶
GetCountryScoresForMap Retrieves the country scores for a map
func GetFriendScoresForMap ¶
func GetFriendScoresForMap(md5 string, userId int, friends []*UserFriend, limit int, page int) ([]*Score, error)
GetFriendScoresForMap Retrieves the friend scores for a map
func GetGlobalScoresForMap ¶
GetGlobalScoresForMap Retrieves the global scores for a map
func GetModifierScoresForMap ¶
GetModifierScoresForMap Retrieves the modifier scores for a map
func GetRateScoresForMap ¶
GetRateScoresForMap Retrieves the rate scores for a map
func GetScoreById ¶
GetScoreById Retrieves a score from the database by its id
func GetUserBestScoresForMode ¶
GetUserBestScoresForMode Retrieves a user's best scores for a given game mode
func GetUserFirstPlaceScoresForMode ¶
func GetUserFirstPlaceScoresForMode(id int, mode enums.GameMode, limit int, page int) ([]*Score, error)
GetUserFirstPlaceScoresForMode Retrieves a user's first place scores for a given mode
func GetUserGradeScoresForMode ¶
func GetUserGradeScoresForMode(id int, mode enums.GameMode, grade string, limit int, page int) ([]*Score, error)
GetUserGradeScoresForMode Retrieves a user's scores for a particular grade
func GetUserPersonalBestScoreAll ¶
GetUserPersonalBestScoreAll Retrieves a user's personal best ALL score on a given map
func GetUserPersonalBestScoreGlobal ¶
GetUserPersonalBestScoreGlobal Retrieves a user's personal best global score on a given map
func GetUserPersonalBestScoreMods ¶
GetUserPersonalBestScoreMods Retrieves a user's personal best modifier score on a given map
func GetUserPersonalBestScoreRate ¶
GetUserPersonalBestScoreRate Retrieves a user's personal best rate score on a given map
type ScoreFirstPlace ¶
type ScoreFirstPlace struct { MD5 string `gorm:"column:md5" json:"md5"` UserId int `gorm:"column:user_id" json:"user_id"` ScoreId int `gorm:"column:score_id" json:"score_id"` PerformanceRating float64 `gorm:"column:performance_rating" json:"performance_rating"` }
func GetUserFirstPlaces ¶
func GetUserFirstPlaces(userId int) ([]*ScoreFirstPlace, error)
GetUserFirstPlaces Retrieves all of a user's first place scores
func (*ScoreFirstPlace) TableName ¶
func (s *ScoreFirstPlace) TableName() string
type Team ¶
type Team struct { Developers []*User `json:"developers"` Administrators []*User `json:"administrators"` Moderators []*User `json:"moderators"` RankingSupervisors []*User `json:"ranking_supervisors"` Contributors []*User `json:"contributors"` }
func GetTeamMembers ¶
GetTeamMembers Returns users in the Quaver team
type TermCustom ¶
type User ¶
type User struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` SteamId string `gorm:"column:steam_id" json:"steam_id"` Username string `gorm:"column:username" json:"username"` TimeRegistered int64 `gorm:"column:time_registered" json:"-"` TimeRegisteredJSON time.Time `gorm:"-:all" json:"time_registered"` Allowed bool `gorm:"column:allowed" json:"allowed"` Privileges enums.Privileges `gorm:"column:privileges" json:"privileges"` UserGroups enums.UserGroups `gorm:"column:usergroups" json:"usergroups"` MuteEndTime int64 `gorm:"column:mute_endtime" json:"-"` MuteEndTimeJSON time.Time `gorm:"-:all" json:"mute_end_time"` LatestActivity int64 `gorm:"column:latest_activity" json:"-"` LatestActivityJSON time.Time `gorm:"-:all" json:"latest_activity"` Country string `gorm:"column:country" json:"country"` IP string `gorm:"column:ip" json:"-"` AvatarUrl *string `gorm:"column:avatar_url" json:"avatar_url"` Twitter *string `gorm:"column:twitter" json:"twitter"` Title *string `gorm:"column:title" json:"title"` CheckedPreviousAchievements bool `gorm:"column:checked_previous_achievements" json:"-"` UserPage *string `gorm:"column:userpage" json:"userpage"` TwitchUsername *string `gorm:"column:twitch_username" json:"twitch_username"` DonatorEndTime int64 `gorm:"column:donator_end_time" json:"-"` DonatorEndTimeJSON time.Time `gorm:"-:all" json:"donator_end_time"` Notes *string `gorm:"column:notes" json:"-"` DiscordId *string `gorm:"column:discord_id" json:"discord_id"` Information *string `gorm:"column:information" json:"-"` MiscInformation *UserInformation `gorm:"-:all" json:"misc_information"` UserPageDisabled bool `gorm:"column:userpage_disabled" json:"-"` ClanId *int `gorm:"column:clan_id" json:"clan_id"` ClanLeaveTime int64 `gorm:"column:clan_leave_time" json:"-"` ClanLeaveTimeJSON time.Time `gorm:"-:all" json:"clan_leave_time"` ShadowBanned bool `gorm:"column:shadow_banned" json:"-"` RememberToken *string `gorm:"column:remember_token" json:"-"` ClientStatus *UserClientStatus `gorm:"-:all" json:"client_status"` StatsKeys4 *UserStatsKeys4 `gorm:"foreignKey:UserId" json:"stats_keys4,omitempty"` StatsKeys7 *UserStatsKeys7 `gorm:"foreignKey:UserId" json:"stats_keys7,omitempty"` }
func GetCountryLeaderboard ¶
func GetCountryLeaderboard(country string, mode enums.GameMode, page int, limit int) ([]*User, error)
GetCountryLeaderboard Retrieves the country leaderboard for a given country and mode
func GetGlobalLeaderboard ¶
GetGlobalLeaderboard Retrieves the global leaderboard for a specific game mode
func GetRankingSupervisors ¶
GetRankingSupervisors Returns users who are Ranking Supervisors
func GetTotalHitsLeaderboard ¶
GetTotalHitsLeaderboard Retrieves the total hits leaderboard for a specific game mode
func GetUserById ¶
GetUserById Retrieves a user from the database by their user id
func GetUserBySteamId ¶
GetUserBySteamId Retrieves a user from the database by their steam id
func GetUserByUsername ¶
GetUserByUsername Retrieves a user from the database by their username
func GetUsersInClan ¶
GetUsersInClan Retrieves all the users that are in a given clan
func SearchUsersByName ¶
SearchUsersByName Searches for users that have a similar name to the query
func (*User) CanJoinClan ¶
CanJoinClan Returns if the user is eligible to join a new clan
func (*User) IsTrialRankingSupervisor ¶
IsTrialRankingSupervisor Returns if the user is a trial ranking supervisor
func (*User) UpdateDonatorEndTime ¶
UpdateDonatorEndTime UpdateUserGroups Sets & updates a user's donator end time
func (*User) UpdateUserGroups ¶
func (u *User) UpdateUserGroups(groups enums.UserGroups) error
UpdateUserGroups Sets & updates a user's usergroups
type UserAchievement ¶
type UserAchievement struct { UserId int `gorm:"column:user_id" json:"user_id"` AchievementId int `gorm:"column_achievement_id" json:"achievement_id"` }
func (*UserAchievement) TableName ¶
func (*UserAchievement) TableName() string
type UserActivity ¶
type UserActivity struct { Id int `gorm:"column:id; PRIMARY_KEY" json:"id"` UserId int `gorm:"column:user_id" json:"user_id"` Type UserActivityType `gorm:"column:type" json:"type"` Timestamp int64 `gorm:"column:timestamp" json:"-"` TimestampJSON time.Time `gorm:"-:all" json:"timestamp"` Value string `gorm:"column:value" json:"value"` MapsetId int `gorm:"mapset_id" json:"mapset_id"` }
func GetRecentUserActivity ¶
func GetRecentUserActivity(id int, limit int, page int) ([]*UserActivity, error)
GetRecentUserActivity Gets the most recent user activity
func (*UserActivity) BeforeCreate ¶
func (ua *UserActivity) BeforeCreate(*gorm.DB) (err error)
func (*UserActivity) Insert ¶
func (ua *UserActivity) Insert() error
Insert Inserts a new user activity to the database directly with the object
func (*UserActivity) TableName ¶
func (*UserActivity) TableName() string
type UserActivityType ¶
type UserActivityType int
const ( UserActivityRegistered UserActivityType = iota UserActivityUploadedMapset UserActivityUpdatedMapset UserActivityRankedMapset UserActivityDeniedMapset UserActivityAchievedFirstPlace UserActivityLostFirstPlace UserActivityUnlockedAchievement UserActivityDonated UserActivityReceivedDonatorGift )
type UserBadge ¶
type UserClientStatus ¶
type UserClientStatus struct { Status int `json:"status"` Mode int `json:"mode"` Content string `json:"content"` }
func GetUserClientStatus ¶
func GetUserClientStatus(id int) (*UserClientStatus, error)
GetUserClientStatus Retrieves a user's client status from Redis
type UserFriend ¶
func GetUserFriends ¶
func GetUserFriends(userId int) ([]*UserFriend, error)
GetUserFriends Returns a user's friends list
type UserInformation ¶
type UserInformation struct { Discord string `json:"discord,omitempty"` Twitter string `json:"twitter,omitempty"` Twitch string `json:"twitch,omitempty"` Youtube string `json:"youtube,omitempty"` NotifyMapsetActions bool `json:"notif_action_mapset,omitempty"` DefaultMode enums.GameMode `json:"default_mode,omitempty"` }
type UserMostPlayedMap ¶
type UserMostPlayedMap struct { Id int `gorm:"column:id" json:"id"` CreatorId int `gorm:"column:creator_id" json:"creator_id"` CreatorUsername string `gorm:"column:creator_username" json:"creator_username"` Artist string `gorm:"column:artist" json:"artist"` Title string `gorm:"column:title" json:"title"` DifficultyName string `gorm:"column:difficulty_name" json:"difficulty_name"` Count int `gorm:"column:COUNT(*)" json:"count"` }
func GetUserMostPlayedMaps ¶
func GetUserMostPlayedMaps(id int, limit int, page int) ([]*UserMostPlayedMap, error)
GetUserMostPlayedMaps Returns a user's most played maps
type UserNotification ¶
type UserNotification struct { Id int `gorm:"column:id; PRIMARY KEY" json:"id"` SenderId int `gorm:"column:sender_id" json:"sender_id"` ReceiverId int `gorm:"column:receiver_id" json:"receiver_id"` Type UserNotificationType `gorm:"column:type" json:"type"` Category UserNotificationCategory `gorm:"column:category" json:"category"` RawData string `gorm:"column:data" json:"-"` Data json.RawMessage `gorm:"-:all" json:"data"` ReadAt int64 `gorm:"column:read_at" json:"-"` ReadAtJSON time.Time `gorm:"-:all" json:"read_at"` Timestamp int64 `gorm:"column:timestamp" json:"-"` TimestampJSON time.Time `gorm:"-:all" json:"timestamp"` User *User `gorm:"foreignKey:SenderId; references:Id" json:"user"` }
func GetNotificationById ¶
func GetNotificationById(id int) (*UserNotification, error)
GetNotificationById Retrieves a user notification by id
func GetNotifications ¶
func GetNotifications(userId int, unreadOnly bool, page int, limit int, category UserNotificationCategory) ([]*UserNotification, error)
GetNotifications Retrieves a user's notifications
func NewClanInviteNotification ¶
func NewClanInviteNotification(clan *Clan, invite *ClanInvite) *UserNotification
NewClanInviteNotification Returns a new clan invite notification
func NewClanKickedNotification ¶
func NewClanKickedNotification(clan *Clan, userId int) *UserNotification
NewClanKickedNotification Returns a new clan kicked notification
func NewDonatorExpiredNotification ¶
func NewDonatorExpiredNotification(userId int) *UserNotification
NewDonatorExpiredNotification Returns a new donator expired notification
func NewMapModCommentNotification ¶
func NewMapModCommentNotification(mapQua *MapQua, mod *MapMod, comment *MapModComment) *UserNotification
NewMapModCommentNotification Returns a new map mod comment notification
func NewMapModNotification ¶
func NewMapModNotification(mapQua *MapQua, mod *MapMod) *UserNotification
NewMapModNotification Returns a new map mod notification
func NewMapsetActionNotification ¶
func NewMapsetActionNotification(mapset *Mapset, comment *MapsetRankingQueueComment) *UserNotification
Returns a new mapset ranking queue action notification
func NewMapsetRankedNotification ¶
func NewMapsetRankedNotification(mapset *Mapset) *UserNotification
NewMapsetRankedNotification Returns a new ranked mapset notification
func NewOrderItemGiftNotification ¶
func NewOrderItemGiftNotification(order *Order) *UserNotification
NewOrderItemGiftNotification Returns a new order gift notification
func (*UserNotification) Insert ¶
func (n *UserNotification) Insert() error
func (*UserNotification) TableName ¶
func (*UserNotification) TableName() string
func (*UserNotification) UpdateReadStatus ¶
func (n *UserNotification) UpdateReadStatus(isRead bool) error
UpdateReadStatus Updates the read status of a notification
type UserNotificationCategory ¶
type UserNotificationCategory int
const ( NotificationCategoryProfile UserNotificationCategory = iota + 1 NotificationCategoryClan NotificationCategoryRankingQueue NotificationCategoryMapModding )
type UserNotificationType ¶
type UserNotificationType int
const ( NotificationMapsetRanked UserNotificationType = iota + 1 NotificationMapsetAction NotificationMapMod NotificationMapModComment NotificationClanInvite NotificationMuted NotificationReceivedOrderItemGift NotificationDonatorExpired NotificationClanKicked )
type UserRank ¶
type UserRankKeys4 ¶
type UserRankKeys4 UserRank
func (*UserRankKeys4) TableName ¶
func (ur *UserRankKeys4) TableName() string
type UserRankKeys7 ¶
type UserRankKeys7 UserRank
func (*UserRankKeys7) TableName ¶
func (ur *UserRankKeys7) TableName() string
type UserRanks ¶
type UserRelationship ¶
type UserRelationship struct { Id int `gorm:"column:id" json:"-"` UserId int `gorm:"column:user_id" json:"-"` TargetUserId int `gorm:"column:target_user_id" json:"-"` Relationship int8 `gorm:"column:relationship" json:"-"` User *User `gorm:"foreignKey:TargetUserId" json:"-"` }
func GetUserRelationship ¶
func GetUserRelationship(userId int, targetUserId int) (*UserRelationship, error)
GetUserRelationship Retrieves a user relationship in the database
func (*UserRelationship) TableName ¶
func (*UserRelationship) TableName() string
type UserStats ¶
type UserStats struct { UserId int `gorm:"column:user_id" json:"-"` Ranks *UserRanks `gorm:"-:all" json:"ranks"` TotalScore int64 `gorm:"column:total_score" json:"total_score"` RankedScore int64 `gorm:"column:ranked_score" json:"ranked_score"` OverallAccuracy float64 `gorm:"column:overall_accuracy" json:"overall_accuracy"` OverallPerformanceRating float64 `gorm:"column:overall_performance_rating" json:"overall_performance_rating"` PlayCount int `gorm:"column:play_count" json:"play_count"` FailCount int `gorm:"column:fail_count" json:"fail_count"` MaxCombo int `gorm:"column:max_combo" json:"max_combo"` TotalMarvelous int `gorm:"column:total_marv" json:"total_marvelous"` TotalPerfect int `gorm:"column:total_perf" json:"total_perfect"` TotalGreat int `gorm:"column:total_great" json:"total_great"` TotalGood int `gorm:"column:total_good" json:"total_good"` TotalOkay int `gorm:"column:total_okay" json:"total_okay"` TotalMiss int `gorm:"column:total_miss" json:"total_miss"` CountGradeX int `gorm:"column:count_grade_x" json:"count_grade_x"` CountGradeSS int `gorm:"column:count_grade_ss" json:"count_grade_ss"` CountGradeS int `gorm:"column:count_grade_s" json:"count_grade_s"` CountGradeA int `gorm:"column:count_grade_a" json:"count_grade_a"` CountGradeB int `gorm:"column:count_grade_b" json:"count_grade_b"` CountGradeC int `gorm:"column:count_grade_c" json:"count_grade_c"` CountGradeD int `gorm:"column:count_grade_d" json:"count_grade_d"` }
type UserStatsKeys4 ¶
type UserStatsKeys4 UserStats
func (*UserStatsKeys4) TableName ¶
func (*UserStatsKeys4) TableName() string
type UserStatsKeys7 ¶
type UserStatsKeys7 UserStats
func (*UserStatsKeys7) TableName ¶
func (*UserStatsKeys7) TableName() string
type UsernameChange ¶
type UsernameChange struct { Id int `gorm:"column:id; PRIMARY_KEY"` UserId int `gorm:"column:user_Id"` PreviousUsername string `gorm:"previous_username"` Timestamp int64 `gorm:"timestamp"` }
func (*UsernameChange) TableName ¶
func (*UsernameChange) TableName() string
type WeeklyMostPlayedMapsets ¶
type WeeklyMostPlayedMapsets struct { MapsetId int `gorm:"column:mapset_id" json:"id"` CreatorId int `gorm:"column:creator_id" json:"creator_id"` CreatorUsername string `gorm:"column:creator_username" json:"creator_username"` Artist string `gorm:"column:artist" json:"artist"` Title string `gorm:"column:title" json:"title"` Count int `gorm:"column:COUNT(*)" json:"count"` }
func GetWeeklyMostPlayedMapsets ¶
func GetWeeklyMostPlayedMapsets(ignoreCache bool) ([]*WeeklyMostPlayedMapsets, error)
GetWeeklyMostPlayedMapsets Retrieves the most played mapsets in the past week
Source Files ¶
- admin_action_logs.go
- applications.go
- chat_messages.go
- clan_activity.go
- clan_invites.go
- clan_leaderboard.go
- clan_scores.go
- clan_stats.go
- clans.go
- crash_logs.go
- elasticsearch.go
- elasticsearch_mapsets.go
- elasticsearch_objects.go
- game_builds.go
- leaderboard.go
- map_mods.go
- map_mods_comments.go
- maps.go
- mapset_downloads.go
- mapset_ranking_queue.go
- mapset_ranking_queue_comments.go
- mapsets.go
- most_played_maps.go
- multiplayer_game_matches.go
- multiplayer_games.go
- multiplayer_map_shares.go
- multiplayer_match_scores.go
- order_items.go
- order_subscriptions_stripe.go
- orders.go
- pinned_scores.go
- playlists.go
- playlists_maps.go
- playlists_mapsets.go
- redis.go
- redis_score.go
- scores.go
- scores_first_place.go
- server_stats.go
- sql.go
- team.go
- user_achievements.go
- user_activity.go
- user_badges.go
- user_notifications.go
- user_ranks.go
- user_relationships.go
- user_stats.go
- username_changes.go
- users.go