Documentation
¶
Index ¶
- func ClearStaleSC2ReplayStatsUpdateLocks(orm *gorm.DB, ttl int) error
- func InitializeORM(cfg config.DBConfig) (*gorm.DB, error)
- func InitializeRedis(host string, port string) (*redis.Pool, error)
- type DiscordChannel
- type DiscordGuild
- type DiscordUser
- type SC2ReplayStatsUser
- func (user *SC2ReplayStatsUser) API() sc2r.API
- func (user *SC2ReplayStatsUser) FetchLastReplay() (sc2r.Replay, error)
- func (user *SC2ReplayStatsUser) GetSubscriptions(db *gorm.DB) ([]Subscription, error)
- func (user *SC2ReplayStatsUser) LockForUpdate(orm *gorm.DB) error
- func (user *SC2ReplayStatsUser) TouchLastCheckedAt(orm *gorm.DB) error
- func (user *SC2ReplayStatsUser) UnlockForUpdate(orm *gorm.DB) error
- func (user *SC2ReplayStatsUser) UpdateLastReplay(orm *gorm.DB) (sc2r.Replay, bool, error)
- type Subscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DiscordChannel ¶
type DiscordChannel struct {
ID uint `gorm:"primaryKey"`
DiscordGuildID uint `gorm:"not null"`
DiscordGuild DiscordGuild `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
DiscordID string
Name string
IsDM bool
CreatedAt time.Time
UpdatedAt time.Time
}
func (*DiscordChannel) UpdateFromDgo ¶
type DiscordGuild ¶
type DiscordGuild struct {
ID uint `gorm:"primaryKey"`
DiscordID string
Name string
OwnerID string
CreatedAt time.Time
UpdatedAt time.Time
}
func GetDMGuild ¶
func GetDMGuild(orm *gorm.DB) (DiscordGuild, error)
func (*DiscordGuild) UpdateFromDgo ¶
type DiscordUser ¶
type DiscordUser struct {
ID uint `gorm:"primaryKey"`
DiscordID string
Name string
Discriminator string
CreatedAt time.Time
UpdatedAt time.Time
}
func (*DiscordUser) UpdateFromDgo ¶
type SC2ReplayStatsUser ¶
type SC2ReplayStatsUser struct {
ID uint `gorm:"primaryKey"`
DiscordUserID uint `gorm:"not null"`
DiscordUser DiscordUser `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
APIKey string
LastReplayID int
LastCheckedAt time.Time
UpdateScheduledAt time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
func SC2ReplayStatsUsersWithStaleData ¶
func SC2ReplayStatsUsersWithStaleData(orm *gorm.DB, updateInterval int) ([]SC2ReplayStatsUser, error)
func (*SC2ReplayStatsUser) API ¶
func (user *SC2ReplayStatsUser) API() sc2r.API
func (*SC2ReplayStatsUser) FetchLastReplay ¶
func (user *SC2ReplayStatsUser) FetchLastReplay() (sc2r.Replay, error)
func (*SC2ReplayStatsUser) GetSubscriptions ¶
func (user *SC2ReplayStatsUser) GetSubscriptions(db *gorm.DB) ([]Subscription, error)
func (*SC2ReplayStatsUser) LockForUpdate ¶
func (user *SC2ReplayStatsUser) LockForUpdate(orm *gorm.DB) error
func (*SC2ReplayStatsUser) TouchLastCheckedAt ¶
func (user *SC2ReplayStatsUser) TouchLastCheckedAt(orm *gorm.DB) error
func (*SC2ReplayStatsUser) UnlockForUpdate ¶
func (user *SC2ReplayStatsUser) UnlockForUpdate(orm *gorm.DB) error
func (*SC2ReplayStatsUser) UpdateLastReplay ¶
type Subscription ¶
type Subscription struct {
ID uint `gorm:"primaryKey"`
DiscordChannelID uint `gorm:"not null"`
DiscordChannel DiscordChannel `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
SC2ReplayStatsUserID uint `gorm:"not null"`
SC2ReplayStatsUser SC2ReplayStatsUser `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
CreatedAt time.Time
UpdatedAt time.Time
}
func (*Subscription) GetSC2ReplayStatsUser ¶
func (subscription *Subscription) GetSC2ReplayStatsUser(db *gorm.DB) (SC2ReplayStatsUser, error)
Click to show internal directories.
Click to hide internal directories.