mongo

package
v0.0.0-...-a97d171 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: GPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlatformWindows = "windows"
	PlatformMac     = "macos"
	PlatformLinux   = "linux"
)
View Source
const (
	CollectionAppAchievements     collection = "app_achievements"
	CollectionAppArticles         collection = "app_articles"
	CollectionAppDLC              collection = "app_dlc"
	CollectionAppItems            collection = "app_items"
	CollectionApps                collection = "apps"
	CollectionAppSales            collection = "app_offers"
	CollectionAppSameOwners       collection = "app_same_owners"
	CollectionBundles             collection = "bundles"
	CollectionBundlePrices        collection = "bundle_prices"
	CollectionChangeItems         collection = "change_products"
	CollectionChanges             collection = "changes"
	CollectionChatBotCommands     collection = "chat_bot_commands"
	CollectionDelayQueue          collection = "delay_queue"
	CollectionDiscordGuilds       collection = "discord_guilds"
	CollectionEvents              collection = "events"
	CollectionGroups              collection = "groups"
	CollectionPackageApps         collection = "package_apps"
	CollectionPackages            collection = "packages"
	CollectionWebhooks            collection = "patreon_webhooks"
	CollectionPlayerAchievements  collection = "player_achievements"
	CollectionPlayerAliases       collection = "player_aliases"
	CollectionPlayerApps          collection = "player_apps"
	CollectionPlayerAppsRecent    collection = "player_apps_recent"
	CollectionPlayerBadges        collection = "player_badges"
	CollectionPlayerBadgesSummary collection = "player_badges_summary"
	CollectionPlayerFriends       collection = "player_friends"
	CollectionPlayerGroups        collection = "player_groups"
	CollectionPlayers             collection = "players"
	CollectionPlayerWishlistApps  collection = "player_wishlist_apps"
	CollectionProductPrices       collection = "product_prices"
	CollectionStats               collection = "stats"
)
View Source
const (
	PrivacyState            helpers.Bits = 1 << iota // Friends list, badges, Steam Level, showcases, comments, and group membership.
	PrivacyStateInventory                            // Items you've received in games that use Steam Trading. It also includes any Steam Trading Cards you've collected and extra copies or Steam Gifts.
	PrivacyStateGifts                                // Always keep Steam Gifts private even if users can see my inventory.
	PrivacyStateOwnedGames                           // The list of all games on your Steam account, games you’ve wishlisted, your achievements and your playtime.
	PrivacyStatePlaytime                             // Always keep my total playtime private even if users can see my game details.
	PrivacyStateFriendsList                          // This controls who can see your list of friends on your Steam Community profile.
)
View Source
const BundleTypeCompleteTheSet = "cts"
View Source
const BundleTypePurchaseTogether = "pt"

Variables

View Source
var ErrInvalidAppID = errors.New("invalid app id")
View Source
var ErrInvalidGroupID = errors.New("invalid group id")
View Source
var (
	ErrInvalidPackageID = errors.New("invalid package id")
)
View Source
var ErrNoDocuments = mongo.ErrNoDocuments
View Source
var GetPlayersInGameLock sync.Mutex
View Source
var GetPlayersOnlineLock sync.Mutex

Only used for steam app 0

View Source
var PackageOutputForJSON = bson.M{"id": 1, "name": 1, "apps_count": 1, "prices": 1, "change_number_date": 1, "icon": 1, "billing_type": 1}

Functions

func BatchApps

func BatchApps(filter bson.D, projection bson.M, callback func(apps []App)) (err error)

func BatchBundles

func BatchBundles(filter bson.D, projection bson.M, callback func(bundles []Bundle)) (err error)

func BatchPackages

func BatchPackages(filter bson.D, projection bson.M, callback func(packages []Package)) (err error)

func BatchStats

func BatchStats(typex StatsType, callback func(stats []Stat)) (err error)

func BulkUpdatePlayers

func BulkUpdatePlayers(writes []mongo.WriteModel) (err error)

func ChunkApps

func ChunkApps(strings []App, n int) (chunks [][]App)

func Close

func Close()

func CountDocuments

func CountDocuments(collection collection, filter bson.D, ttl uint32) (count int64, err error)

func CountFriends

func CountFriends(playerID int64) (count int64, err error)

func DeleteAppDLC

func DeleteAppDLC(appID int, DLCs []int) (err error)

func DeleteAppItems

func DeleteAppItems(appID int, items []int) (err error)

func DeleteFriends

func DeleteFriends(playerID int64, friends []int64) (err error)

func DeleteMany

func DeleteMany(collection collection, filter bson.D) (resp *mongo.DeleteResult, err error)

func DeleteOne

func DeleteOne(collection collection, filter bson.D) (resp *mongo.DeleteResult, err error)

noinspection GoUnusedExportedFunction

func DeletePackageApps

func DeletePackageApps(packageID int, appIDs []int) (err error)

func DeletePlayerGroups

func DeletePlayerGroups(playerID int64, groupIDs []string) (err error)

func DeletePlayerWishlistApps

func DeletePlayerWishlistApps(playerID int64, apps []int) (err error)

func DeleteRecentApps

func DeleteRecentApps(playerID int64, apps []int) (err error)

func EnsureIndexes

func EnsureIndexes()

func EnsureStat

func EnsureStat(typex StatsType, ids []int, names []string) (err error)

func FindLatestPlayerAchievement

func FindLatestPlayerAchievement(playerID int64, appID int) (int64, error)

func FindOne

func FindOne(collection collection, filter bson.D, sort bson.D, projection bson.M, document Document) (err error)

func FindOrCreateStatsByName

func FindOrCreateStatsByName(typex StatsType, names []string) (IDs []int, err error)

func GetDistict

func GetDistict(collection collection, field string) (values []interface{}, err error)

func GetGuildsByIDs

func GetGuildsByIDs(ids []string) (guildsMap map[string]DiscordGuild, err error)

func GetHighestSaleOrder

func GetHighestSaleOrder() (int, error)

func GetRandomRows

func GetRandomRows(collection collection, count int, filter bson.D, projection bson.M) (cur *mongo.Cursor, ctx context.Context, err error)

func GetUniqueSaleTypes

func GetUniqueSaleTypes() (types []string, err error)

func InsertMany

func InsertMany(collection collection, documents []Document) (resp *mongo.InsertManyResult, err error)

Will skip documents that already exist

func InsertOne

func InsertOne(collection collection, document Document) (resp *mongo.InsertOneResult, err error)

Errors if key already exists

func NewEvent

func NewEvent(r *http.Request, userID int, eventType EventEnum) (err error)

func ReplaceAppAchievements

func ReplaceAppAchievements(achievements []AppAchievement) (err error)

func ReplaceAppDLCs

func ReplaceAppDLCs(DLCs []AppDLC) (err error)

func ReplaceAppItems

func ReplaceAppItems(items []AppItem) (err error)

func ReplaceAppSameOwners

func ReplaceAppSameOwners(appID int, sameApps []AppSameOwners) (err error)

func ReplaceArticles

func ReplaceArticles(articles []Article) (err error)

func ReplaceOne

func ReplaceOne(collection collection, filter bson.D, document Document) (resp *mongo.UpdateResult, err error)

Create or update whole document

func ReplacePackageApps

func ReplacePackageApps(apps []PackageApp) (err error)

func ReplacePlayerAchievements

func ReplacePlayerAchievements(achievements []PlayerAchievement) (err error)

func ReplacePlayerAliases

func ReplacePlayerAliases(aliases []PlayerAlias) (err error)

func ReplacePlayerBadges

func ReplacePlayerBadges(badges []PlayerBadge) (err error)

func ReplacePlayerFriends

func ReplacePlayerFriends(friends []*PlayerFriend) (err error)

func ReplacePlayerGroups

func ReplacePlayerGroups(groups []PlayerGroup) (err error)

func ReplacePlayerWishlistApps

func ReplacePlayerWishlistApps(apps []PlayerWishlistApp) (err error)

func ReplaceRecentApps

func ReplaceRecentApps(apps []PlayerRecentApp) (err error)

func ReplaceSales

func ReplaceSales(offers []Sale) (err error)

func SaveWebhook

func SaveWebhook(service WebhookService, event string, body string) error

func UpdateAppsInflux

func UpdateAppsInflux(writes []mongo.WriteModel) (err error)

func UpdateBadgeSummary

func UpdateBadgeSummary(id int) (err error)

func UpdateManySet

func UpdateManySet(collection collection, filter bson.D, update bson.D) (resp *mongo.UpdateResult, err error)

Does NOT upsert

func UpdateManyUnset

func UpdateManyUnset(collection collection, columns bson.D) (resp *mongo.UpdateResult, err error)

noinspection GoUnusedExportedFunction

func UpdateOne

func UpdateOne(collection collection, filter bson.D, update bson.D) (resp *mongo.UpdateResult, err error)

Does not upsert

func UpdatePlayerApps

func UpdatePlayerApps(apps map[int]*PlayerApp) (err error)

Types

type App

type App struct {
	Achievements                  []helpers.Tuple                `bson:"achievements_5"` // Icon -> Title
	AchievementsAverageCompletion float64                        `bson:"achievements_average_completion"`
	AchievementsCount             int                            `bson:"achievements_count"`
	AchievementsCountTotal        int                            `bson:"achievements_count_total"` // Including inactive ones
	AlbumMetaData                 pics.AlbumMetaData             `bson:"albummetadata"`
	Background                    string                         `bson:"background"`
	BadgeOwners                   int64                          `bson:"badge_owners"`
	Bundles                       []int                          `bson:"bundle_ids"`
	Categories                    []int                          `bson:"categories"`
	ChangeNumber                  int                            `bson:"change_number"`
	ChangeNumberDate              time.Time                      `bson:"change_number_date"`
	ComingSoon                    bool                           `bson:"coming_soon"`
	Common                        pics.PICSKeyValues             `bson:"common"`
	Config                        pics.PICSKeyValues             `bson:"config"`
	CreatedAt                     time.Time                      `bson:"created_at"`
	Countries                     map[string]int                 `bson:"countries"`
	Demos                         []int                          `bson:"demo_ids"`
	Depots                        pics.Depots                    `bson:"depots"`
	Developers                    []int                          `bson:"developers"`
	DLCCount                      int                            `bson:"dlc_count"`
	Extended                      pics.PICSKeyValues             `bson:"extended"`
	GameID                        int                            `bson:"game_id"`
	GameName                      string                         `bson:"game_name"`
	Genres                        []int                          `bson:"genres"`
	GroupID                       string                         `bson:"group_id"`
	GroupFollowers                int                            `bson:"group_followers"`
	Homepage                      string                         `bson:"homepage"`
	Icon                          string                         `bson:"icon"`
	ID                            int                            `bson:"_id" json:"id"`
	Install                       map[string]interface{}         `bson:"install"`
	IsFree                        bool                           `bson:"is_free"`
	Items                         int                            `bson:"items"`
	ItemsDigest                   string                         `bson:"items_digest"`
	Launch                        []pics.PICSAppConfigLaunchItem `bson:"launch"`
	Localization                  pics.Localisation              `bson:"localization"`
	LocalizationCount             int                            `bson:"localization_count"`
	MetacriticScore               int8                           `bson:"metacritic_score"`
	MetacriticURL                 string                         `bson:"metacritic_url"`
	Movies                        []helpers.AppVideo             `bson:"movies"`
	Name                          string                         `bson:"name"`
	NewsIDs                       []int64                        `bson:"news_ids"`
	Owners                        int64                          `bson:"owners"` // On Global Steam
	Packages                      []int                          `bson:"packages"`
	Platforms                     []string                       `bson:"platforms"`
	PlayerAverageWeek             float64                        `bson:"player_avg_week"`
	PlayerPeakAllTime             int                            `bson:"player_peak_alltime"`
	PlayerPeakAllTimeTime         time.Time                      `bson:"player_peak_alltime_time"`
	PlayerPeakWeek                int                            `bson:"player_peak_week"`
	PlayerTrend                   float64                        `bson:"player_trend"`
	PlaytimeAverage               float64                        `bson:"playtime_average"` // Minutes
	PlaytimeTotal                 int64                          `bson:"playtime_total"`   // Minutes
	Prices                        helpers.ProductPrices          `bson:"prices"`
	PublicOnly                    bool                           `bson:"public_only"`
	Publishers                    []int                          `bson:"publishers"`
	RelatedAppIDs                 []int                          `bson:"related_app_ids"`             // Taken from store page
	RelatedOwnersAppIDsDate       time.Time                      `bson:"related_owners_app_ids_date"` // Calculated from owners - Last Updated
	ReleaseDate                   string                         `bson:"release_date"`                // Steam release
	ReleaseDateUnix               int64                          `bson:"release_date_unix"`           // Steam release
	ReleaseDateOriginal           int64                          `bson:"release_date_original"`       // Game release
	ReleaseState                  string                         `bson:"release_state"`
	Reviews                       helpers.AppReviewSummary       `bson:"reviews"`
	ReviewsScore                  float64                        `bson:"reviews_score"`
	ReviewsCount                  int                            `bson:"reviews_count"`
	Screenshots                   []helpers.AppImage             `bson:"screenshots"`
	ShortDescription              string                         `bson:"description_short"`
	Stats                         []helpers.AppStat              `bson:"stats"`
	SteamSpy                      helpers.AppSteamSpy            `bson:"steam_spy"`
	SystemRequirements            map[string]interface{}         `bson:"system_requirements"`
	Tags                          []int                          `bson:"tags"`       // Current tags, used for filtering
	TagCounts                     []AppTagCount                  `bson:"tag_counts"` // Includes old tags
	TwitchID                      int                            `bson:"twitch_id"`
	TwitchURL                     string                         `bson:"twitch_url"`
	Type                          string                         `bson:"type"`
	UFS                           pics.PICSKeyValues             `bson:"ufs"`
	UpdatedAt                     time.Time                      `bson:"updated_at"`
	Version                       string                         `bson:"version"`
	WishlistAvgPosition           float64                        `bson:"wishlist_avg_position"`
	WishlistCount                 int                            `bson:"wishlist_count"`
	WishlistPercent               float64                        `bson:"wishlist_percent"`
	WishlistFirsts                float64                        `bson:"wishlist_firsts"`
}

func GetApp

func GetApp(id int, full ...bool) (app App, err error)

func GetApps

func GetApps(offset int64, limit int64, sort bson.D, filter bson.D, projection bson.M) (apps []App, err error)

func GetAppsByID

func GetAppsByID(ids []int, projection bson.M) (apps []App, err error)

func PopularApps

func PopularApps() (apps []App, err error)

func PopularNewApps

func PopularNewApps() (apps []App, err error)

func TrendingApps

func TrendingApps() (apps []App, err error)

func (App) BSON

func (app App) BSON() bson.D

func (App) GetAppRelatedApps

func (app App) GetAppRelatedApps() (apps []App, err error)

func (App) GetBackground

func (app App) GetBackground() string

For an interface

func (App) GetCategories

func (app App) GetCategories() (stats []Stat, err error)
func (app App) GetCommunityLink() string

func (App) GetCoopTags

func (app App) GetCoopTags() (string, error)

func (App) GetDemos

func (app App) GetDemos() (demos []App, err error)

func (App) GetDevelopers

func (app App) GetDevelopers() (stats []Stat, err error)

func (App) GetDevelopersHTML

func (app App) GetDevelopersHTML() template.HTML

func (App) GetFollowers

func (app App) GetFollowers() string

func (App) GetGenres

func (app App) GetGenres() (stats []Stat, err error)

func (App) GetGroupID

func (app App) GetGroupID() string

func (App) GetHeaderImage

func (app App) GetHeaderImage() string

460 x 215

func (App) GetID

func (app App) GetID() int

func (App) GetIcon

func (app App) GetIcon() string
func (app App) GetInstallLink() template.URL

func (App) GetMetaImage

func (app App) GetMetaImage() string

func (App) GetMicroTrailer

func (app App) GetMicroTrailer() string

func (App) GetName

func (app App) GetName() string

func (App) GetPICSUpdatedNice

func (app App) GetPICSUpdatedNice() string

func (App) GetPath

func (app App) GetPath() string

func (App) GetPathAbsolute

func (app App) GetPathAbsolute() string

func (App) GetPeakTimeNice

func (app App) GetPeakTimeNice() string

func (App) GetPlatformImages

func (app App) GetPlatformImages() (ret template.HTML)
func (app App) GetPlayLink() template.URL

func (App) GetPlayersInGame

func (app App) GetPlayersInGame() (players int64, err error)

func (App) GetPlayersOnline

func (app App) GetPlayersOnline() (players int64, err error)

func (App) GetPlayersPeakWeek

func (app App) GetPlayersPeakWeek() int

func (App) GetPlaytimeAverage

func (app App) GetPlaytimeAverage() string

func (App) GetPrices

func (app App) GetPrices() (prices helpers.ProductPrices)

func (App) GetProductType

func (app App) GetProductType() helpers.ProductType

func (App) GetPublishers

func (app App) GetPublishers() (stats []Stat, err error)

func (App) GetPublishersHTML

func (app App) GetPublishersHTML() template.HTML

func (App) GetReleaseDateNice

func (app App) GetReleaseDateNice() string

func (App) GetReviewScore

func (app App) GetReviewScore() string

func (App) GetSteamPricesURL

func (app App) GetSteamPricesURL() string
func (app App) GetStoreLink() string

func (App) GetSystemRequirements

func (app App) GetSystemRequirements() (ret []helpers.SystemRequirement)

func (App) GetTags

func (app App) GetTags() (stats []Stat, err error)

func (App) GetTrend

func (app App) GetTrend() string

func (App) GetType

func (app App) GetType() string

func (App) GetTypeLower

func (app App) GetTypeLower() (ret string)

func (App) GetUpdatedNice

func (app App) GetUpdatedNice() string

func (App) HasSameOwners

func (app App) HasSameOwners() bool

func (App) ReadPICS

func (app App) ReadPICS(m map[string]string) (config pics.PICSKeyValues)

func (App) ShouldUpdate

func (app App) ShouldUpdate() bool

type AppAchievement

type AppAchievement struct {
	AppID       int     `bson:"app_id" json:"app_id"`
	Key         string  `bson:"key" json:"key"`
	Name        string  `bson:"name" json:"name"`
	Description string  `bson:"description" json:"description"`
	Icon        string  `bson:"icon" json:"icon"`
	Completed   float64 `bson:"completed" json:"completed"`
	Hidden      bool    `bson:"hidden" json:"hidden"`   // Just no description
	Active      bool    `bson:"active" json:"active"`   // If it's part of the schema response
	Deleted     bool    `bson:"deleted" json:"deleted"` // Not in global resp anymore
}

func GetAppAchievements

func GetAppAchievements(offset int64, limit int64, filter bson.D, sort bson.D) (achievements []AppAchievement, err error)

func (AppAchievement) BSON

func (achievement AppAchievement) BSON() bson.D

func (*AppAchievement) Fill

func (achievement *AppAchievement) Fill(appID int, response steamapi.SchemaForGameAchievement)

func (AppAchievement) GetCompleted

func (achievement AppAchievement) GetCompleted() string

func (AppAchievement) GetIcon

func (achievement AppAchievement) GetIcon() string

func (AppAchievement) GetKey

func (achievement AppAchievement) GetKey() string

type AppDLC

type AppDLC struct {
	AppID           int    `bson:"app_id"`
	DLCID           int    `bson:"dlc_id"`
	Icon            string `bson:"icon"`
	Name            string `bson:"name"`
	ReleaseDateUnix int64  `bson:"release_date_unix"`
	ReleaseDateNice string `bson:"release_date_nice"`
}

func GetDLCForApp

func GetDLCForApp(offset int64, limit int64, filter bson.D, sort bson.D, projection bson.M) (dlcs []AppDLC, err error)

func GetDLCForApps

func GetDLCForApps(appIDs []int, offset int64, limit int64, filter bson.D, sort bson.D, projection bson.M) (dlcs []AppDLC, err error)

func (AppDLC) BSON

func (dlc AppDLC) BSON() bson.D

func (AppDLC) GetIcon

func (dlc AppDLC) GetIcon() (ret string)

func (AppDLC) GetName

func (dlc AppDLC) GetName() string

func (AppDLC) GetPath

func (dlc AppDLC) GetPath() string

type AppItem

type AppItem struct {
	AppID            int        `bson:"app_id"`
	Bundle           string     `bson:"bundle"`
	Commodity        bool       `bson:"commodity"`
	DateCreated      string     `bson:"date_created"`
	Description      string     `bson:"description"`
	DisplayType      string     `bson:"display_type"`
	DropInterval     int        `bson:"drop_interval"`
	DropMaxPerWindow int        `bson:"drop_max_per_window"`
	Exchange         []string   `bson:"exchange"`
	Hash             string     `bson:"hash"`
	IconURL          string     `bson:"icon_url"`
	IconURLLarge     string     `bson:"icon_url_large"`
	ItemDefID        int        `bson:"item_def_id"`
	ItemQuality      string     `bson:"item_quality"`
	Marketable       bool       `bson:"marketable"`
	Modified         string     `bson:"modified"`
	Name             string     `bson:"name"`
	Price            string     `bson:"price"`
	Promo            string     `bson:"promo"`
	Quantity         int        `bson:"quantity"`
	Tags             [][]string `bson:"tags"`
	Timestamp        string     `bson:"timestamp"`
	Tradable         bool       `bson:"tradable"`
	Type             string     `bson:"type"`
	WorkshopID       int64      `bson:"workshop_id"`
}

func GetAppItems

func GetAppItems(offset int64, limit int64, filter bson.D, projection bson.M) (items []AppItem, err error)

func (AppItem) BSON

func (item AppItem) BSON() bson.D

func (AppItem) GetType

func (item AppItem) GetType() string

func (*AppItem) Image

func (item *AppItem) Image(size int, crop bool) string
func (item *AppItem) Link() string

func (*AppItem) SetExchange

func (item *AppItem) SetExchange(exchange string)

func (*AppItem) SetTags

func (item *AppItem) SetTags(tagsString string)

func (AppItem) ShortDescription

func (item AppItem) ShortDescription() string

type AppReleaseDateCount

type AppReleaseDateCount struct {
	Date  string `json:"date" bson:"_id"`
	Count int64  `json:"count" bson:"count"`
}

func GetAppsGroupedByReleaseDate

func GetAppsGroupedByReleaseDate() (counts []AppReleaseDateCount, err error)

type AppReviewScoreCount

type AppReviewScoreCount struct {
	Score int64 `json:"score" bson:"_id"`
	Count int64 `json:"count" bson:"count"`
}

func GetAppsGroupedByReviewScore

func GetAppsGroupedByReviewScore() (counts []AppReviewScoreCount, err error)

type AppSameOwners

type AppSameOwners struct {
	AppID     int     `bson:"app_id"`
	SameAppID int     `bson:"same_id"`
	Count     int     `bson:"count"`  // Matching owners
	Order     float64 `bson:"order"`  // Score to sort by
	Owners    int     `bson:"owners"` // Total owners
}

func GetAppSameOwners

func GetAppSameOwners(appID int, limit int64) (sameOwners []AppSameOwners, err error)

func (AppSameOwners) BSON

func (sameOwner AppSameOwners) BSON() bson.D

func (AppSameOwners) GetKey

func (sameOwner AppSameOwners) GetKey() string

type AppTagCount

type AppTagCount struct {
	ID    int    `json:"id"`
	Name  string `json:"name"`
	Count int    `json:"count"`
}

func (AppTagCount) GetPath

func (t AppTagCount) GetPath() string

type AppTypeCount

type AppTypeCount struct {
	Type  string `json:"type" bson:"_id"`
	Count int64  `json:"count" bson:"count"`
	Value int64  `json:"value" bson:"value"`
}

func GetAppsGroupedByType

func GetAppsGroupedByType(code steamapi.ProductCC) (counts []AppTypeCount, err error)

func (AppTypeCount) Format

func (atc AppTypeCount) Format() string

Used in templates

type Article

type Article struct {
	ID          int64     `bson:"_id"`
	Title       string    `bson:"title"`
	URL         string    `bson:"url"`
	IsExternal  bool      `bson:"is_external"`
	Author      string    `bson:"author"`
	Contents    string    `bson:"contents"`
	Date        time.Time `bson:"date"`
	FeedLabel   string    `bson:"feed_label"`
	FeedName    string    `bson:"feed_name"`
	FeedType    int8      `bson:"feed_type"`
	AppID       int       `bson:"app_id"`
	AppName     string    `bson:"app_name"`
	AppIcon     string    `bson:"app_icon"`
	ArticleIcon string    `bson:"icon"`
}

func GetArticles

func GetArticles(offset int64, limit int64, order bson.D, filter bson.D) (news []Article, err error)

func (Article) BSON

func (article Article) BSON() bson.D

func (Article) GetAppIcon

func (article Article) GetAppIcon() string

func (Article) GetAppPath

func (article Article) GetAppPath() string

func (Article) GetArticleIcon

func (article Article) GetArticleIcon() string

func (Article) GetBody

func (article Article) GetBody() template.HTML

func (Article) GetDate

func (article Article) GetDate() string

type ArticleFeed

type ArticleFeed struct {
	ID    string `bson:"_id" json:"id"`
	Name  string `bson:"name" json:"name"`
	Count int    `bson:"count" json:"count"`
}

func GetAppArticlesGroupedByFeed

func GetAppArticlesGroupedByFeed(appID int) (feeds []ArticleFeed, err error)

func (ArticleFeed) GetCount

func (af ArticleFeed) GetCount() string

func (ArticleFeed) GetName

func (af ArticleFeed) GetName() string

type Bundle

type Bundle struct {
	Apps            []int                      `bson:"apps"`
	CreatedAt       time.Time                  `bson:"created_at"`
	Discount        int                        `bson:"discount"`
	DiscountHighest int                        `bson:"discount_highest"`
	DiscountLowest  int                        `bson:"discount_lowest"`
	DiscountSale    int                        `bson:"discount_sale"`
	Giftable        bool                       `bson:"giftable"`
	Icon            string                     `bson:"icon"`
	ID              int                        `bson:"_id"`
	Image           string                     `bson:"image"`
	Name            string                     `bson:"name"`
	OnSale          bool                       `bson:"on_sale"`
	Packages        []int                      `bson:"packages"`
	Prices          map[steamapi.ProductCC]int `bson:"prices"`
	PricesSale      map[steamapi.ProductCC]int `bson:"prices_sale"`
	Type            string                     `bson:"type"`
	UpdatedAt       time.Time                  `bson:"updated_at"`
}

func GetBundle

func GetBundle(id int) (bundle Bundle, err error)

func GetBundles

func GetBundles(offset int64, limit int64, sort bson.D, filter bson.D, projection bson.M) (bundles []Bundle, err error)

func GetBundlesByID

func GetBundlesByID(ids []int, projection bson.M) (bundles []Bundle, err error)

func (Bundle) BSON

func (bundle Bundle) BSON() bson.D

func (Bundle) GetApps

func (bundle Bundle) GetApps() int

func (Bundle) GetCreated

func (bundle Bundle) GetCreated() time.Time

func (Bundle) GetCreatedNice

func (bundle Bundle) GetCreatedNice() string

func (Bundle) GetDiscount

func (bundle Bundle) GetDiscount() int

func (Bundle) GetDiscountHighest

func (bundle Bundle) GetDiscountHighest() int

func (Bundle) GetDiscountSale

func (bundle Bundle) GetDiscountSale() int

func (Bundle) GetID

func (bundle Bundle) GetID() int

func (Bundle) GetName

func (bundle Bundle) GetName() string

func (Bundle) GetPackages

func (bundle Bundle) GetPackages() int

func (Bundle) GetPath

func (bundle Bundle) GetPath() string

func (Bundle) GetPrices

func (bundle Bundle) GetPrices() map[steamapi.ProductCC]int

func (Bundle) GetPricesFormatted

func (bundle Bundle) GetPricesFormatted() map[steamapi.ProductCC]string

func (Bundle) GetPricesSaleFormatted

func (bundle Bundle) GetPricesSaleFormatted() map[steamapi.ProductCC]string

func (Bundle) GetScore

func (bundle Bundle) GetScore() float64
func (bundle Bundle) GetStoreLink() string

func (Bundle) GetType

func (bundle Bundle) GetType() string

func (Bundle) GetUpdated

func (bundle Bundle) GetUpdated() time.Time

func (Bundle) GetUpdatedNice

func (bundle Bundle) GetUpdatedNice() string

func (Bundle) IsGiftable

func (bundle Bundle) IsGiftable() bool

func (Bundle) OutputForJSON

func (bundle Bundle) OutputForJSON() (output []interface{})

type BundlePrice

type BundlePrice struct {
	CreatedAt time.Time `bson:"created_at"`
	BundleID  int       `bson:"bundle_id"`
	Discount  int       `bson:"price"`
}

func GetBundlePrices

func GetBundlePrices(filter bson.D) (prices []BundlePrice, err error)

func GetBundlePricesByID

func GetBundlePricesByID(bundleID int) (prices []BundlePrice, err error)

func (BundlePrice) BSON

func (price BundlePrice) BSON() bson.D

func (BundlePrice) GetKey

func (price BundlePrice) GetKey() string

type Change

type Change struct {
	ID        int       `bson:"_id"`
	CreatedAt time.Time `bson:"created_at"`
	Apps      []int     `bson:"apps"`
	Packages  []int     `bson:"packages"`
}

func GetChange

func GetChange(id int64) (change Change, err error)

func GetChanges

func GetChanges(offset int64) (changes []Change, err error)

func (Change) BSON

func (change Change) BSON() bson.D

func (Change) GetName

func (change Change) GetName() (name string)

func (Change) GetNiceDate

func (change Change) GetNiceDate() string

func (Change) GetPath

func (change Change) GetPath() string

func (Change) GetTimestamp

func (change Change) GetTimestamp() int64

func (Change) OutputForJSON

func (change Change) OutputForJSON(allApps map[int]string, allPackages map[int]string) (output []interface{})

type Count

type Count struct {
	ID    int `json:"id" bson:"_id"`
	Count int `json:"count"`
}

func GetAchievmentCounts

func GetAchievmentCounts(appID int) (counts []Count, err error)

func GetPlayerLevels

func GetPlayerLevels() (counts []Count, err error)

func GetPlayerLevelsRounded

func GetPlayerLevelsRounded() (counts []Count, err error)

type DateCount

type DateCount struct {
	Date  string `json:"date" bson:"_id"`
	Count int    `json:"count"`
}

func GetPlayerAchievementDays

func GetPlayerAchievementDays(playerID int64) (counts []DateCount, err error)

func GetPlayerUpdateDays

func GetPlayerUpdateDays() (counts []DateCount, err error)

type DiscordGuild

type DiscordGuild struct {
	ID       string    `bson:"_id"`
	Name     string    `bson:"name"`
	Icon     string    `bson:"icon"`
	Members  int       `json:"members"`
	Requests int       `json:"requests"`
	UpdateAt time.Time `json:"update_at"`
}

func GetGuilds

func GetGuilds(offset int64, limit int64, sort bson.D, filter bson.D) (guilds []DiscordGuild, err error)

func (DiscordGuild) BSON

func (guild DiscordGuild) BSON() bson.D

type DiscordMessage

type DiscordMessage struct {
	GuildID      string    `bson:"guild_id"`
	ChannelID    string    `bson:"channel_id"`
	AuthorID     string    `bson:"author_id"`
	CommandID    string    `bson:"command_id"`
	AuthorName   string    `bson:"author_name"`
	AuthorAvatar string    `bson:"author_avatar"`
	Message      string    `bson:"message"`
	Slash        bool      `bson:"slash"`
	Time         time.Time `bson:"time"`
}

func GetChatBotCommandsRecent

func GetChatBotCommandsRecent() (commands []DiscordMessage, err error)

func (DiscordMessage) BSON

func (c DiscordMessage) BSON() bson.D

func (DiscordMessage) GetAvatar

func (c DiscordMessage) GetAvatar() string

func (DiscordMessage) GetCommand

func (c DiscordMessage) GetCommand() string

func (DiscordMessage) GetTableRowJSON

func (c DiscordMessage) GetTableRowJSON(guilds map[string]DiscordGuild) []interface{}

type Document

type Document interface {
	BSON() bson.D
}

type Event

type Event struct {
	CreatedAt time.Time `bson:"created_at"`
	Type      EventEnum `bson:"type"`
	UserID    int       `bson:"user_id"`
	UserAgent string    `bson:"user_agent"`
	IP        string    `bson:"ip"`
}

func GetEvents

func GetEvents(filter bson.D, offset int64) (events []Event, err error)

func (Event) BSON

func (event Event) BSON() bson.D

func (Event) GetCreatedNice

func (event Event) GetCreatedNice() (t string)

func (Event) GetIcon

func (event Event) GetIcon() string

type EventEnum

type EventEnum string
var (
	EventSignup         EventEnum = "signup"
	EventLogin          EventEnum = "login"
	EventForgotPassword EventEnum = "forgot-password"
	EventLogout         EventEnum = "logout"
	EventPatreonWebhook EventEnum = "patreon-webhook"
	EventRefresh        EventEnum = "refresh"
	EventLink                     = func(provider oauth.ProviderEnum) EventEnum { return EventEnum("link-" + provider) }
	EventUnlink                   = func(provider oauth.ProviderEnum) EventEnum { return EventEnum("unlink-" + provider) }
)

func (EventEnum) ToString

func (event EventEnum) ToString() string

type Group

type Group struct {
	ID            string    `bson:"_id"` // Too big for int64 in Javascript (Mongo BD)
	CreatedAt     time.Time `bson:"created_at"`
	UpdatedAt     time.Time `bson:"updated_at"`
	Name          string    `bson:"name"`
	Abbr          string    `bson:"abbreviation"`
	URL           string    `bson:"url"`
	AppID         int       `bson:"app_id"`
	Headline      string    `bson:"headline"`
	Summary       string    `bson:"summary"`
	Icon          string    `bson:"icon"`
	Trending      float64   `bson:"trending"`
	Members       int       `bson:"members"`
	MembersInChat int       `bson:"members_in_chat"`
	MembersInGame int       `bson:"members_in_game"`
	MembersOnline int       `bson:"members_online"`
	Error         string    `bson:"error"`
	Type          string    `bson:"type"`
	Primaries     int       `bson:"primaries"`
}

func GetGroup

func GetGroup(id string) (group Group, err error)

func GetGroups

func GetGroups(offset int64, limit int64, sort bson.D, filter bson.D, projection bson.M) (groups []Group, err error)

func GetGroupsByID

func GetGroupsByID(ids []string, projection bson.M) (groups []Group, err error)

func TrendingGroups

func TrendingGroups() (groups []Group, err error)

func (Group) BSON

func (group Group) BSON() bson.D

func (Group) GetAbbr

func (group Group) GetAbbr() string

func (Group) GetIcon

func (group Group) GetIcon() string

func (Group) GetIconAbsolute

func (group Group) GetIconAbsolute() string

func (Group) GetName

func (group Group) GetName() string

func (Group) GetPath

func (group Group) GetPath() string

func (Group) GetTrend

func (group Group) GetTrend() string

func (Group) GetType

func (group Group) GetType() string

func (Group) GetURL

func (group Group) GetURL() string

func (Group) IsOfficial

func (group Group) IsOfficial() bool

func (Group) ShouldUpdate

func (group Group) ShouldUpdate() bool

type Package

type Package struct {
	Apps             []int                 `bson:"apps"`
	AppItems         map[int]int           `bson:"app_items"`
	AppsCount        int                   `bson:"apps_count"`
	Bundles          []int                 `bson:"bundle_ids"`
	BillingType      int32                 `bson:"billing_type"`
	ChangeNumber     int                   `bson:"change_id"`
	ChangeNumberDate time.Time             `bson:"change_number_date"`
	ComingSoon       bool                  `bson:"coming_soon"`
	Controller       pics.PICSController   `bson:"controller"`
	CreatedAt        time.Time             `bson:"created_at"`
	Depots           []int                 `bson:"depot_ids"`
	Extended         pics.PICSKeyValues    `bson:"extended"`
	Icon             string                `bson:"icon"`
	ID               int                   `bson:"_id" json:"id"`
	ImagePage        string                `bson:"image_page"`
	InStore          bool                  `bson:"in_store"` // todo
	LicenseType      int32                 `bson:"license_type"`
	Name             string                `bson:"name"`
	Platforms        []string              `bson:"platforms"`
	Prices           helpers.ProductPrices `bson:"prices"`
	PurchaseText     string                `bson:"purchase_text"`
	ReleaseDate      string                `bson:"release_date"`
	ReleaseDateUnix  int64                 `bson:"release_date_unix"`
	Status           int8                  `bson:"status"`
	UpdatedAt        time.Time             `bson:"updated_at"`
}

func GetPackage

func GetPackage(id int) (pack Package, err error)

func GetPackages

func GetPackages(offset int64, limit int64, sort bson.D, filter bson.D, projection bson.M) (packages []Package, err error)

func GetPackagesByID

func GetPackagesByID(ids []int, projection bson.M) (packages []Package, err error)

func (Package) BSON

func (pack Package) BSON() bson.D

func (Package) GetBillingType

func (pack Package) GetBillingType() string

func (Package) GetBundles

func (pack Package) GetBundles() (bundles []Bundle, err error)

func (Package) GetComingSoon

func (pack Package) GetComingSoon() string

func (Package) GetID

func (pack Package) GetID() int

func (Package) GetIcon

func (pack Package) GetIcon() string

func (Package) GetLicenseType

func (pack Package) GetLicenseType() string

func (Package) GetMetaImage

func (pack Package) GetMetaImage() string

func (Package) GetName

func (pack Package) GetName() (name string)

func (Package) GetPICSUpdatedNice

func (pack Package) GetPICSUpdatedNice() string

func (Package) GetPath

func (pack Package) GetPath() string

func (Package) GetPlatformImages

func (pack Package) GetPlatformImages() (ret template.HTML)

func (Package) GetPrices

func (pack Package) GetPrices() (prices helpers.ProductPrices)

func (Package) GetProductType

func (pack Package) GetProductType() helpers.ProductType

func (Package) GetStatus

func (pack Package) GetStatus() string

func (Package) GetType

func (pack Package) GetType() string

func (Package) GetUpdatedNice

func (pack Package) GetUpdatedNice() string

func (Package) HasEmptyIcon

func (pack Package) HasEmptyIcon() bool

func (Package) HasEmptyName

func (pack Package) HasEmptyName() bool

func (Package) OutputForJSON

func (pack Package) OutputForJSON(code steamapi.ProductCC) (output []interface{})

func (Package) Save

func (pack Package) Save() (err error)

func (*Package) SetName

func (pack *Package) SetName(name string, force bool)

func (Package) ShouldUpdate

func (pack Package) ShouldUpdate() bool
func (pack Package) StoreLink() string

type PackageApp

type PackageApp struct {
	PackageID    int      `bson:"package_id"`
	AppID        int      `bson:"app_id"`
	AppIcon      string   `bson:"app_icon"`
	AppName      string   `bson:"app_name"`
	AppType      string   `bson:"app_type"`
	AppPlatforms []string `bson:"app_platforms"`
	AppDLCCount  int      `bson:"app_dlc_count"`
}

func GetPackageApps

func GetPackageApps(packageID int, offset int64, sort bson.D) (apps []PackageApp, err error)

func (PackageApp) BSON

func (app PackageApp) BSON() bson.D

type Player

type Player struct {
	AchievementCount         int                        `bson:"achievement_count"`      // Number of achievements
	AchievementCount100      int                        `bson:"achievement_count_100"`  // Number of 100% games
	AchievementCountApps     int                        `bson:"achievement_count_apps"` // Number of games with an achievement
	Avatar                   string                     `bson:"avatar"`
	BackgroundAppID          int                        `bson:"background_app_id"`
	BadgesCount              int                        `bson:"badges_count"`
	BadgesFoilCount          int                        `bson:"badges_foil_count"`
	BadgeStats               ProfileBadgeStats          `bson:"badge_stats"`
	Bans                     PlayerBans                 `bson:"bans"`
	CommentsCount            int                        `bson:"comments_count"`
	CommunityVisibilityState int                        `bson:"community_visibility_state"` // 1=private 3=public
	ContinentCode            string                     `bson:"continent_code"`
	CountryCode              string                     `bson:"country_code"`
	CreatedAt                time.Time                  `bson:"created_at"` // Added late
	Donated                  int                        `bson:"donated"`
	FriendsCount             int                        `bson:"friends_count"`
	GamesByType              map[string]int             `bson:"games_by_type"`
	GamesCount               int                        `bson:"games_count"`
	GameStats                PlayerAppStatsTemplate     `bson:"game_stats"`
	GroupsCount              int                        `bson:"groups_count"`
	ID                       int64                      `bson:"_id"`
	LastBan                  time.Time                  `bson:"bans_last"`
	Level                    int                        `bson:"level"`
	NumberOfGameBans         int                        `bson:"bans_game"`
	NumberOfVACBans          int                        `bson:"bans_cav"`
	Permissions              helpers.Bits               `bson:"permissions"`
	PersonaName              string                     `bson:"persona_name"`
	PlayTime                 int                        `bson:"play_time"`
	PlayTimeWindows          int                        `bson:"play_time_windows"`
	PlayTimeMac              int                        `bson:"play_time_mac"`
	PlayTimeLinux            int                        `bson:"play_time_linux"`
	PrimaryGroupID           string                     `bson:"primary_clan_id_string"`
	Private                  bool                       `bson:"private"`
	Ranks                    map[helpers.RankMetric]int `bson:"ranks"`
	RecentAppsCount          int                        `bson:"recent_apps_count"`
	Removed                  bool                       `bson:"removed"` // Removed from Steam
	AwardsGivenCount         int                        `bson:"awards_given_count"`
	AwardsGivenPoints        int                        `bson:"awards_given_points"`
	AwardsReceivedCount      int                        `bson:"awards_received_count"`
	AwardsReceivedPoints     int                        `bson:"awards_received_points"`
	StateCode                string                     `bson:"status_code"`
	TimeCreated              time.Time                  `bson:"time_created"` // Created on Steam
	UpdatedAt                time.Time                  `bson:"updated_at"`
	VanityURL                string                     `bson:"vanity_url"`
	WishlistAppsCount        int                        `bson:"wishlist_apps_count"`
	WishlistTotalCost        map[steamapi.ProductCC]int `bson:"wishlist_total_cost"`
}

func GetPlayer

func GetPlayer(id int64) (player Player, err error)

func GetPlayers

func GetPlayers(offset int64, limit int64, sort bson.D, filter bson.D, projection bson.M) (players []Player, err error)

func GetPlayersByID

func GetPlayersByID(ids []int64, projection bson.M) (players []Player, err error)

func (Player) BSON

func (player Player) BSON() bson.D
func (player Player) CommunityLink() string
func (player Player) FriendsLink() string

func (Player) GetAchievements

func (player Player) GetAchievements() int

func (Player) GetAvatar

func (player Player) GetAvatar() string

func (Player) GetAvatar2

func (player Player) GetAvatar2() string

func (Player) GetAvatarAbsolute

func (player Player) GetAvatarAbsolute() string

func (Player) GetBadges

func (player Player) GetBadges() int

func (Player) GetBadgesFoil

func (player Player) GetBadgesFoil() int

func (Player) GetCountry

func (player Player) GetCountry() string

func (Player) GetFlag

func (player Player) GetFlag() string
func (player Player) GetFriendLink() template.URL

func (Player) GetGameBans

func (player Player) GetGameBans() int

func (Player) GetGamesCount

func (player Player) GetGamesCount() int

func (Player) GetLastBan

func (player Player) GetLastBan() time.Time

func (Player) GetLevel

func (player Player) GetLevel() int

func (Player) GetMaxFriends

func (player Player) GetMaxFriends() int
func (player Player) GetMessageLink() template.URL

func (Player) GetName

func (player Player) GetName() string

func (Player) GetPath

func (player Player) GetPath() string

func (Player) GetPathAbsolute

func (player Player) GetPathAbsolute() string

func (Player) GetPlaytime

func (player Player) GetPlaytime() int

func (Player) GetPlaytimePercent

func (player Player) GetPlaytimePercent(platform string) (ret string)

func (Player) GetPlaytimeShort

func (player Player) GetPlaytimeShort(platform string, max int) (ret string)

func (Player) GetRanks

func (player Player) GetRanks() map[helpers.RankMetric]int

func (Player) GetStateName

func (player Player) GetStateName() string

func (Player) GetSteamTimeNice

func (player Player) GetSteamTimeNice() string

func (Player) GetSteamTimeUnix

func (player Player) GetSteamTimeUnix() int64

func (Player) GetUpdatedNice

func (player Player) GetUpdatedNice() string

func (Player) GetUpdatedUnix

func (player Player) GetUpdatedUnix() int64

func (Player) GetVACBans

func (player Player) GetVACBans() int

func (Player) GetWishlistTotal

func (player Player) GetWishlistTotal(cc steamapi.ProductCC) string
func (player Player) GroupsLink() string

func (Player) NeedsUpdate

func (player Player) NeedsUpdate(updateType UpdateType) bool
func (player Player) WishlistLink() string

type PlayerAchievement

type PlayerAchievement struct {
	PlayerID               int64   `bson:"player_id"`
	PlayerName             string  `bson:"player_name"`
	PlayerIcon             string  `bson:"player_icon"`
	AppID                  int     `bson:"app_id"`
	AppName                string  `bson:"app_name"`
	AppIcon                string  `bson:"app_icon"`
	AchievementID          string  `bson:"achievement_id"`
	AchievementName        string  `bson:"achievement_name"`
	AchievementIcon        string  `bson:"achievement_icon"`
	AchievementDescription string  `bson:"achievement_description"`
	AchievementDate        int64   `bson:"achievement_date"`
	AchievementComplete    float64 `bson:"achievement_complete"` // Percent
}

func GetPlayerAchievementsByPlayer

func GetPlayerAchievementsByPlayer(playerID int64, offset int64, sort bson.D) (achievements []PlayerAchievement, err error)

func GetPlayerAchievementsByPlayerAndApp

func GetPlayerAchievementsByPlayerAndApp(playerID int64, appID int) (achievements []PlayerAchievement, err error)

func GetPlayerAchievementsByPlayersAndApp

func GetPlayerAchievementsByPlayersAndApp(playerIDs []int64, appID int) (achievements []PlayerAchievement, err error)

func (PlayerAchievement) BSON

func (a PlayerAchievement) BSON() bson.D

func (PlayerAchievement) GetAchievementIcon

func (a PlayerAchievement) GetAchievementIcon() string

func (PlayerAchievement) GetComplete

func (a PlayerAchievement) GetComplete() string

func (PlayerAchievement) GetDate

func (a PlayerAchievement) GetDate() string

type PlayerAlias

type PlayerAlias struct {
	PlayerID   int64  `bson:"player_id"`
	PlayerName string `bson:"player_name"`
	Time       int64  `bson:"time"`
}

func GetPlayerAliases

func GetPlayerAliases(playerID int64, limit int64, afterTimestamp int64) (aliases []PlayerAlias, err error)

func (PlayerAlias) BSON

func (a PlayerAlias) BSON() bson.D

func (PlayerAlias) GetTime

func (a PlayerAlias) GetTime() string

type PlayerApp

type PlayerApp struct {
	PlayerID      int64              `bson:"player_id"`
	PlayerCountry string             `json:"player_country"`
	AppID         int                `bson:"app_id"`
	AppName       string             `bson:"app_name"`
	AppIcon       string             `bson:"app_icon"`
	AppTime       int                `bson:"app_time"`
	AppPrices     map[string]int     `bson:"app_prices"`
	AppPriceHour  map[string]float64 `bson:"app_prices_hour"`
	AppDLCCount   int                `bson:"app_dlc_count"`

	AppAchievementsTotal   int     `bson:"app_achievements_total"`
	AppAchievementsHave    int     `bson:"app_achievements_have"`
	AppAchievementsPercent float64 `bson:"app_achievements_percent"`
}

func GetAppOwners

func GetAppOwners(appID int) ([]PlayerApp, error)

func GetAppPlayTimes

func GetAppPlayTimes(appID int) ([]PlayerApp, error)

func GetPlayerAppByKey

func GetPlayerAppByKey(playerID int64, appID int) (playerApp PlayerApp, err error)

func GetPlayerApps

func GetPlayerApps(offset int64, limit int64, filter bson.D, sort bson.D) (apps []PlayerApp, err error)

func GetPlayerAppsByApp

func GetPlayerAppsByApp(appID int, offset int64, filter bson.D) (apps []PlayerApp, err error)

func GetPlayerAppsByPlayer

func GetPlayerAppsByPlayer(playerID int64, offset int64, limit int64, sort bson.D, projection bson.M, filter bson.D) (apps []PlayerApp, err error)

func GetPlayerAppsByPlayers

func GetPlayerAppsByPlayers(playerIDs []int64, projection bson.M) (apps []PlayerApp, err error)

func GetPlayerAppsByPlayersAndApp

func GetPlayerAppsByPlayersAndApp(playerIDs []int64, appID int) (apps []PlayerApp, err error)

func (PlayerApp) BSON

func (app PlayerApp) BSON() bson.D

func (PlayerApp) BSONUpdate

func (app PlayerApp) BSONUpdate() bson.D

Missing achievement columns so when we update a row we dont overwrite achievements

func (PlayerApp) GetAchievementPercent

func (app PlayerApp) GetAchievementPercent() string

func (PlayerApp) GetHeaderImage

func (app PlayerApp) GetHeaderImage() string

func (PlayerApp) GetIcon

func (app PlayerApp) GetIcon() string

func (PlayerApp) GetKey

func (app PlayerApp) GetKey() string

func (PlayerApp) GetPath

func (app PlayerApp) GetPath() string

func (PlayerApp) GetPriceFormatted

func (app PlayerApp) GetPriceFormatted(code steamapi.ProductCC) string

func (PlayerApp) GetPriceHourFormatted

func (app PlayerApp) GetPriceHourFormatted(code steamapi.ProductCC) string
func (app PlayerApp) GetStoreLink() string

func (PlayerApp) GetTimeNice

func (app PlayerApp) GetTimeNice() string

func (PlayerApp) GetTimeNiceLong

func (app PlayerApp) GetTimeNiceLong() string

type PlayerAppStatsTemplate

type PlayerAppStatsTemplate struct {
	Played playerAppStatsInnerTemplate
	All    playerAppStatsInnerTemplate
}

type PlayerAppsByCountry

type PlayerAppsByCountry struct {
	Country string `json:"type" bson:"_id"`
	Count   int    `json:"count" bson:"count"`
}

func GetAppPlayersByCountry

func GetAppPlayersByCountry(appID int) (items []PlayerAppsByCountry, err error)

type PlayerBadge

type PlayerBadge struct {
	AppID               int       `bson:"app_id"`
	AppName             string    `bson:"app_name"`
	BadgeCompletionTime time.Time `bson:"badge_completion_time"`
	BadgeFoil           bool      `bson:"badge_foil"`
	BadgeIcon           string    `bson:"badge_icon"`
	BadgeID             int       `bson:"badge_id"`
	BadgeItemID         int64     `bson:"-"`
	BadgeLevel          int       `bson:"badge_level"`
	BadgeScarcity       int       `bson:"badge_scarcity"`
	BadgeXP             int       `bson:"badge_xp"`
	PlayerID            int64     `bson:"player_id"`
	PlayerName          string    `bson:"player_name"`
	PlayerIcon          string    `bson:"player_icon"`
}

func GetAppBadge

func GetAppBadge(appID int) (badge PlayerBadge, err error)

Get the first PlayerBadge for an app ID

func GetBadgePlayers

func GetBadgePlayers(offset int64, filter bson.D) (badges []PlayerBadge, err error)

func GetPlayerBadges

func GetPlayerBadges(offset int64, filter bson.D, sort bson.D) (badges []PlayerBadge, err error)

func (PlayerBadge) BSON

func (badge PlayerBadge) BSON() bson.D

func (PlayerBadge) GetAppPath

func (badge PlayerBadge) GetAppPath() string

func (PlayerBadge) GetIcon

func (badge PlayerBadge) GetIcon() string

func (PlayerBadge) GetKey

func (badge PlayerBadge) GetKey() string

func (PlayerBadge) GetName

func (badge PlayerBadge) GetName() string

func (PlayerBadge) GetPath

func (badge PlayerBadge) GetPath() string

func (PlayerBadge) GetPathToggle

func (badge PlayerBadge) GetPathToggle() string
func (badge PlayerBadge) GetPlayerCommunityLink() string

func (PlayerBadge) GetPlayerIcon

func (badge PlayerBadge) GetPlayerIcon() string

func (PlayerBadge) GetPlayerName

func (badge PlayerBadge) GetPlayerName() string

func (PlayerBadge) GetPlayerPath

func (badge PlayerBadge) GetPlayerPath() string

func (PlayerBadge) GetType

func (badge PlayerBadge) GetType() string

func (PlayerBadge) ID

func (badge PlayerBadge) ID() int

func (PlayerBadge) IsEvent

func (badge PlayerBadge) IsEvent() bool

func (PlayerBadge) IsGame

func (badge PlayerBadge) IsGame(appID int) bool

func (PlayerBadge) IsSpecial

func (badge PlayerBadge) IsSpecial() bool

type PlayerBadgeSummary

type PlayerBadgeSummary struct {
	AppID        int               `bson:"app_id"`
	BadgeID      int               `bson:"badge_id"`
	AppName      string            `bson:"app_name"`
	AppIcon      string            `bson:"app_icon"`
	PlayersCount int64             `bson:"players"`
	MaxLevel     int               `bson:"max_level"`
	MaxLevelFoil int               `bson:"max_level_foil"`
	Leaders      map[string]string `bson:"leaders"`      // Must use string for playerID as it's a JSON key
	LeadersFoil  map[string]string `bson:"leaders_foil"` // Must use string for playerID as it's a JSON key
	UpdatedAt    int64             `bson:"updated_at"`
}

func GetBadgeSummaries

func GetBadgeSummaries() (badges []PlayerBadgeSummary, err error)

func (PlayerBadgeSummary) BSON

func (badge PlayerBadgeSummary) BSON() bson.D

func (PlayerBadgeSummary) GetAppLeader

func (badge PlayerBadgeSummary) GetAppLeader(foil bool) (ret template.HTML)

func (PlayerBadgeSummary) GetIcon

func (badge PlayerBadgeSummary) GetIcon() string

func (PlayerBadgeSummary) GetName

func (badge PlayerBadgeSummary) GetName() string

func (PlayerBadgeSummary) GetPath

func (badge PlayerBadgeSummary) GetPath(foil bool) string

func (PlayerBadgeSummary) GetSpecialLeaders

func (badge PlayerBadgeSummary) GetSpecialLeaders() (ret template.HTML)

func (PlayerBadgeSummary) ID

func (badge PlayerBadgeSummary) ID() int

func (PlayerBadgeSummary) IsEvent

func (badge PlayerBadgeSummary) IsEvent() bool

func (PlayerBadgeSummary) IsGame

func (badge PlayerBadgeSummary) IsGame() bool

func (PlayerBadgeSummary) IsSpecial

func (badge PlayerBadgeSummary) IsSpecial() bool

type PlayerBans

type PlayerBans struct {
	CommunityBanned  bool   `json:"community_banned"`
	VACBanned        bool   `json:"vac_banned"`
	NumberOfVACBans  int    `json:"number_of_vac_bans"`
	DaysSinceLastBan int    `json:"days_since_last_ban"`
	NumberOfGameBans int    `json:"number_of_game_bans"`
	EconomyBan       string `json:"economy_ban"`
}

func (PlayerBans) History

func (pb PlayerBans) History() bool

type PlayerFriend

type PlayerFriend struct {
	PlayerID     int64     `bson:"player_id"`    // From Steam API
	FriendID     int64     `bson:"friend_id"`    // From Steam API
	FriendSince  time.Time `bson:"since"`        // From Steam API
	Avatar       string    `bson:"avatar"`       //
	Name         string    `bson:"name"`         //
	Games        int       `bson:"games"`        //
	Level        int       `bson:"level"`        //
	Relationship string    `bson:"relationship"` // From Steam API
}

func GetFriends

func GetFriends(playerID int64, offset int64, limit int64, sort bson.D, filter bson.D) (friends []PlayerFriend, err error)

func (PlayerFriend) BSON

func (friend PlayerFriend) BSON() bson.D
func (friend PlayerFriend) CommunityLink() string

func (PlayerFriend) GetAvatar

func (friend PlayerFriend) GetAvatar() string

func (PlayerFriend) GetFriendSince

func (friend PlayerFriend) GetFriendSince() string

func (PlayerFriend) GetLevel

func (friend PlayerFriend) GetLevel() string

func (PlayerFriend) GetName

func (friend PlayerFriend) GetName() string

func (PlayerFriend) GetPath

func (friend PlayerFriend) GetPath() string

func (PlayerFriend) Scanned

func (friend PlayerFriend) Scanned() bool

type PlayerGroup

type PlayerGroup struct {
	PlayerID      int64  `bson:"player_id"`
	PlayerName    string `bson:"player_name"`
	PlayerAvatar  string `bson:"player_avatar"`
	PlayerCountry string `bson:"player_country"`
	PlayerLevel   int    `bson:"player_level"`
	PlayerGames   int    `bson:"player_games"`
	GroupID       string `bson:"group_id"`
	GroupName     string `bson:"group_name"`
	GroupIcon     string `bson:"group_icon"`
	GroupMembers  int    `bson:"group_members"`
	GroupType     string `bson:"group_type"`
	GroupURL      string `bson:"group_url"`
}

func GetGroupPlayers

func GetGroupPlayers(groupID string, offset int64, order bson.D) (players []PlayerGroup, err error)

func GetPlayerGroups

func GetPlayerGroups(playerID int64, offset int64, limit int64, sort bson.D) (groups []PlayerGroup, err error)

func (PlayerGroup) BSON

func (group PlayerGroup) BSON() bson.D

func (PlayerGroup) GetGroupIcon

func (group PlayerGroup) GetGroupIcon() string

func (PlayerGroup) GetGroupPath

func (group PlayerGroup) GetGroupPath() string

func (PlayerGroup) GetName

func (group PlayerGroup) GetName() string

func (PlayerGroup) GetPlayerAvatar

func (group PlayerGroup) GetPlayerAvatar() string

func (PlayerGroup) GetPlayerAvatar2

func (group PlayerGroup) GetPlayerAvatar2() string
func (group PlayerGroup) GetPlayerCommunityLink() string

func (PlayerGroup) GetPlayerFlag

func (group PlayerGroup) GetPlayerFlag() string
func (group PlayerGroup) GetPlayerLink() string

func (PlayerGroup) GetPlayerName

func (group PlayerGroup) GetPlayerName() string

func (PlayerGroup) GetPlayerPath

func (group PlayerGroup) GetPlayerPath() string

func (PlayerGroup) GetType

func (group PlayerGroup) GetType() string

func (PlayerGroup) GetURL

func (group PlayerGroup) GetURL() string

func (PlayerGroup) IsOfficial

func (group PlayerGroup) IsOfficial() bool

type PlayerRecentApp

type PlayerRecentApp struct {
	PlayerID        int64  `bson:"player_id"`
	AppID           int    `bson:"app_id"`
	AppName         string `bson:"name"`
	PlayTime2Weeks  int    `bson:"playtime_2_weeks"` // Minutes
	PlayTimeForever int    `bson:"playtime_forever"` // Minutes
	Icon            string `bson:"icon"`
}

func GetRecentApps

func GetRecentApps(playerID int64, offset int64, limit int64, sort bson.D) (apps []PlayerRecentApp, err error)

func (PlayerRecentApp) BSON

func (app PlayerRecentApp) BSON() bson.D

func (PlayerRecentApp) GetHeaderImage

func (app PlayerRecentApp) GetHeaderImage() string

func (PlayerRecentApp) GetIcon

func (app PlayerRecentApp) GetIcon() string

type PlayerWishlistApp

type PlayerWishlistApp struct {
	PlayerID           int64                      `bson:"player_id"`
	Order              int                        `bson:"order"`
	AppID              int                        `bson:"app_id"`
	AppName            string                     `bson:"app_name"`
	AppIcon            string                     `bson:"app_icon"`
	AppReleaseState    string                     `bson:"app_release_state"`
	AppReleaseDate     time.Time                  `bson:"app_release_date"`
	AppReleaseDateNice string                     `bson:"app_release_date_nice"`
	AppPrices          map[steamapi.ProductCC]int `bson:"app_prices"`
}

func GetPlayerWishlistAppsByApp

func GetPlayerWishlistAppsByApp(appID int) (apps []PlayerWishlistApp, err error)

func GetPlayerWishlistAppsByPlayer

func GetPlayerWishlistAppsByPlayer(playerID int64, offset int64, limit int64, order bson.D, projection bson.M) (apps []PlayerWishlistApp, err error)

func (PlayerWishlistApp) BSON

func (app PlayerWishlistApp) BSON() bson.D

func (PlayerWishlistApp) GetHeaderImage

func (app PlayerWishlistApp) GetHeaderImage() string

func (PlayerWishlistApp) GetIcon

func (app PlayerWishlistApp) GetIcon() (ret string)

func (PlayerWishlistApp) GetName

func (app PlayerWishlistApp) GetName() string

func (PlayerWishlistApp) GetPath

func (app PlayerWishlistApp) GetPath() string

func (PlayerWishlistApp) GetReleaseDateNice

func (app PlayerWishlistApp) GetReleaseDateNice() string

func (PlayerWishlistApp) GetReleaseState

func (app PlayerWishlistApp) GetReleaseState() (ret string)

type ProductPrice

type ProductPrice struct {
	CreatedAt         time.Time             `bson:"created_at"`
	AppID             int                   `bson:"app_id"`
	PackageID         int                   `bson:"package_id"`
	Currency          steamapi.CurrencyCode `bson:"currency"`
	ProdCC            steamapi.ProductCC    `bson:"prod_cc"`
	Name              string                `bson:"name"`
	Icon              string                `bson:"icon"`
	PriceBefore       int                   `bson:"price_before"`
	PriceAfter        int                   `bson:"price_after"`
	Difference        int                   `bson:"difference"`
	DifferencePercent float64               `bson:"difference_percent"`
}

func GetPrices

func GetPrices(offset int64, limit int64, filter bson.D) (prices []ProductPrice, err error)

func GetPricesByID

func GetPricesByID(IDs []string) (prices []ProductPrice, err error)

func GetPricesForApps

func GetPricesForApps(appIDs []int, cc steamapi.ProductCC) (prices []ProductPrice, err error)

func GetPricesForProduct

func GetPricesForProduct(productID int, productType helpers.ProductType, cc steamapi.ProductCC) (prices []ProductPrice, err error)

func (ProductPrice) BSON

func (price ProductPrice) BSON() bson.D

func (ProductPrice) GetIcon

func (price ProductPrice) GetIcon() string

func (ProductPrice) GetPath

func (price ProductPrice) GetPath() string

func (ProductPrice) GetPercentChange

func (price ProductPrice) GetPercentChange() float64

func (ProductPrice) OutputForJSON

func (price ProductPrice) OutputForJSON() (output []interface{})

type ProfileBadgeStats

type ProfileBadgeStats struct {
	PlayerXP                   int
	PlayerLevel                int
	PlayerXPNeededToLevelUp    int
	PlayerXPNeededCurrentLevel int
	PercentOfLevel             int
}

type Sale

type Sale struct {
	SubID                int                        `bson:"sub_id"`
	SubOrder             int                        `bson:"sub_order"` // Order in the API response
	AppID                int                        `bson:"app_id"`
	AppName              string                     `bson:"app_name"`
	AppIcon              string                     `bson:"app_icon"`
	AppRating            float64                    `bson:"app_rating"`
	AppReleaseDate       time.Time                  `bson:"app_date"`
	AppReleaseDateString string                     `bson:"app_date_string"`
	AppPrices            map[steamapi.ProductCC]int `bson:"app_prices"`
	AppLowestPrice       map[steamapi.ProductCC]int `bson:"app_lowest_price"`
	AppPlayersWeek       int                        `bson:"app_players"`
	AppCategories        []int                      `bson:"app_categories"`
	AppType              string                     `bson:"app_type"`
	AppPlatforms         []string                   `bson:"app_platforms"`
	AppTags              []int                      `bson:"app_tags"`
	SaleStart            time.Time                  `bson:"offer_start"`
	SaleEnd              time.Time                  `bson:"offer_end"`
	SaleEndEstimate      bool                       `bson:"offer_end_estimate"`
	SaleType             string                     `bson:"offer_type"`
	SalePercent          int                        `bson:"offer_percent"`
	SaleName             string                     `bson:"offer_name"`
}

func GetAllSales

func GetAllSales(offset int64, limit int64, filter bson.D, sort bson.D) (offers []Sale, err error)

func GetAppSales

func GetAppSales(appID int) (offers []Sale, err error)

func (Sale) BSON

func (sale Sale) BSON() bson.D

func (Sale) GetAppRating

func (sale Sale) GetAppRating() string

func (Sale) GetKey

func (sale Sale) GetKey() (ret string)

func (Sale) GetOfferName

func (sale Sale) GetOfferName() string

func (Sale) GetPriceInt

func (sale Sale) GetPriceInt() string

func (Sale) GetPriceString

func (sale Sale) GetPriceString(code steamapi.ProductCC) string

func (Sale) GetType

func (sale Sale) GetType() string

func (Sale) IsLowest

func (sale Sale) IsLowest(code steamapi.ProductCC) int

0:not lowest - 1:match lowest - 2:lowest ever

type Stat

type Stat struct {
	Type          StatsType                      `bson:"type"`
	ID            int                            `bson:"id"`
	Name          string                         `bson:"name"`
	Apps          int                            `bson:"apps"`
	AppsPercnt    float32                        `bson:"apps_percent"`
	MeanPrice     map[steamapi.ProductCC]float32 `bson:"mean_price"`
	MeanScore     float32                        `bson:"mean_score"`
	MeanPlayers   float64                        `bson:"mean_players"`
	MedianPrice   map[steamapi.ProductCC]int     `bson:"median_price"`
	MedianScore   float32                        `bson:"median_score"`
	MedianPlayers int                            `bson:"median_players"`
	MaxDiscount   map[steamapi.ProductCC]int     `bson:"max_discount"`
}

func GetStat

func GetStat(typex StatsType, id int) (stat Stat, err error)

func GetStatByName

func GetStatByName(name string) (stat Stat, err error)

func GetStats

func GetStats(offset int64, limit int64, filter bson.D, sort bson.D) (stats []Stat, err error)

func GetStatsByID

func GetStatsByID(typex StatsType, ids []int) (stats []Stat, err error)

func GetStatsByType

func GetStatsByType(typex StatsType, ids []int, id int) (stats []Stat, err error)

func GetStatsForSelect

func GetStatsForSelect(typex StatsType) (stats []Stat, err error)

func (Stat) BSON

func (stat Stat) BSON() bson.D

func (Stat) GetKey

func (stat Stat) GetKey() string

func (Stat) GetPath

func (stat Stat) GetPath() string

type StatsType

type StatsType string

Types

const (
	StatsTypeCategories StatsType = "c"
	StatsTypeDevelopers StatsType = "d"
	StatsTypeGenres     StatsType = "g"
	StatsTypePublishers StatsType = "p"
	StatsTypeTags       StatsType = "t"
)

func (StatsType) MongoCol

func (st StatsType) MongoCol() string

func (StatsType) Plural

func (st StatsType) Plural() string

func (StatsType) String

func (st StatsType) String() string

func (StatsType) Title

func (st StatsType) Title() string

type StringCount

type StringCount struct {
	ID    string `json:"id" bson:"_id"`
	Count int    `json:"count"`
}

func GetEventCounts

func GetEventCounts(userID int) (counts []StringCount, err error)

type UpdateType

type UpdateType string
const (
	PlayerUpdateAuto   UpdateType = "auto"
	PlayerUpdateManual UpdateType = "manual"
	PlayerUpdateAdmin  UpdateType = "admin"
)

type Webhook

type Webhook struct {
	CreatedAt   time.Time      `bson:"created_at"`
	Service     WebhookService `bson:"service"`
	Event       string         `bson:"event"`
	RequestBody string         `bson:"request_body"`
}

func GetWebhooks

func GetWebhooks(offset int64, limit int64, sort bson.D, filter bson.D, projection bson.M) (webhooks []Webhook, err error)

func (Webhook) BSON

func (webhook Webhook) BSON() bson.D

func (Webhook) GetHash

func (webhook Webhook) GetHash() string

func (Webhook) UnmarshalPatreon

func (webhook Webhook) UnmarshalPatreon() (wh patreon.Webhook, err error)

type WebhookService

type WebhookService string
const (
	WebhookServicePatreon  WebhookService = "patreon"
	WebhookServiceGithub   WebhookService = "github"
	WebhookServiceTwitter  WebhookService = "twitter"
	WebhookServiceSendgrid WebhookService = "sendgrid"
	WebhookServiceMailjet  WebhookService = "mailjet"
)

func (WebhookService) ToString

func (s WebhookService) ToString() string

Directories

Path Synopsis
helpers

Jump to

Keyboard shortcuts

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