farmerstate

package
v0.0.0-...-e1e8c9f Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Unlicense Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGuildMembership

func AddGuildMembership(userID, guildID string) bool

AddGuildMembership adds a user to a guild. Returns true if added, false if already a member.

func AddRecentCoopID

func AddRecentCoopID(userID string, coopID string)

AddRecentCoopID adds a coop ID to the recent list (max 5)

func AddTimer

func AddTimer(id, userID, channelID, msgID string, reminder time.Time, message string, duration int64, origChannelID, origMsgID string, active bool)

AddTimer inserts a new timer into the database.

func AddWatch

func AddWatch(userID, watchType, targetID string)

AddWatch inserts a new watch into the database.

func DeleteAllLeaderboardExclusionsForUserInGuild

func DeleteAllLeaderboardExclusionsForUserInGuild(guildID, userID string) error

DeleteAllLeaderboardExclusionsForUserInGuild removes all exclusions for a user in a specific guild.

func DeleteAllLeaderboardOptInsForUserInGuild

func DeleteAllLeaderboardOptInsForUserInGuild(guildID, userID string) error

DeleteAllLeaderboardOptInsForUserInGuild removes all opt-ins for a user in a specific guild.

func DeleteAllLeaderboardStatsForPlayer

func DeleteAllLeaderboardStatsForPlayer(player string) error

DeleteAllLeaderboardStatsForPlayer removes every leaderboard stat for a player globally.

func DeleteAllLeaderboardStatsForPlayerInGuild

func DeleteAllLeaderboardStatsForPlayerInGuild(player, guildID string) error

DeleteAllLeaderboardStatsForPlayerInGuild is a no-op since leaderboard_stats is now global.

func DeleteFarmer

func DeleteFarmer(userID string)

DeleteFarmer deletes a Farmer from the map and SQLite database tables

func DeleteInactiveTimers

func DeleteInactiveTimers()

DeleteInactiveTimers removes all inactive timers from the database.

func DeleteLeaderboardExclusion

func DeleteLeaderboardExclusion(guildID, userID, lbType string) error

DeleteLeaderboardExclusion removes a specific leaderboard exclusion record.

func DeleteLeaderboardOptIn

func DeleteLeaderboardOptIn(guildID, userID, lbType string) error

DeleteLeaderboardOptIn removes a specific leaderboard opt-in record.

func DeleteLeaderboardStatsForPlayer

func DeleteLeaderboardStatsForPlayer(player, lbType string) error

DeleteLeaderboardStatsForPlayer removes snapshots for a specific player and type.

func DeleteTimer

func DeleteTimer(id string)

DeleteTimer removes a timer from the database by its ID.

func DeleteUserWatches

func DeleteUserWatches(userID string)

DeleteUserWatches deletes all watches for a given user.

func DeleteWatch

func DeleteWatch(userID, watchType, targetID string)

DeleteWatch deletes a specific watch.

func FarmerExists

func FarmerExists(userID string) bool

FarmerExists returns true if a record for the given userID exists in farmer_state.

func FlushPendingSaves

func FlushPendingSaves()

FlushPendingSaves forces an immediate write of all pending database updates.

func GetAltControllerByMiscString

func GetAltControllerByMiscString(key, value string) []string

GetAltControllerByMiscString returns all IDs for farmers where MiscSettingsString[key] == value.

func GetDiscordUserIDFromEggIncName

func GetDiscordUserIDFromEggIncName(eggIncName string) (string, error)

GetDiscordUserIDFromEggIncName retrieves the Discord user ID based on the provided eggincname. It also checks if the account is an alternate and returns the parent's Discord ID if so.

func GetDiscordUserIDFromEiIgn

func GetDiscordUserIDFromEiIgn(eiIgn string) (string, error)

GetDiscordUserIDFromEiIgn retrieves the Discord user ID based on the provided ei_ign. It also checks if the account is an alternate and returns the parent's Discord ID if so.

func GetDiscordUserIDFromEiIgnExact

func GetDiscordUserIDFromEiIgnExact(eiIgn string) (string, error)

GetDiscordUserIDFromEiIgnExact retrieves the Discord user ID based on the provided ei_ign without collapsing alternate accounts back to their controller.

func GetEggIncName

func GetEggIncName(userID string) string

GetEggIncName returns a Farmer Egg Inc name

func GetEiIgnsByGuild

func GetEiIgnsByGuild(guildID string) []string

GetEiIgnsByGuild returns all ei_ign values for farmers who are members of the given guild.

func GetEiIgnsByMiscString

func GetEiIgnsByMiscString(key, value string) []string

GetEiIgnsByMiscString returns all ei_ign values for farmers where MiscSettingsString[key] == value.

func GetGuildMembers

func GetGuildMembers(guildID string) []string

GetGuildMembers returns all user IDs that are members of the given guild.

func GetLastSeen

func GetLastSeen(userID string) time.Time

GetLastSeen returns the last time a farmer was added to a contract

func GetLatestLeaderboardSnapDate

func GetLatestLeaderboardSnapDate(lbType string) (string, error)

GetLatestLeaderboardSnapDate returns the most recent snap_date for a lb_type.

func GetLaunchHistory

func GetLaunchHistory(userID string) bool

GetLaunchHistory returns a Farmer Launch History

func GetLeaderboardOptInUsers

func GetLeaderboardOptInUsers() ([]string, error)

GetLeaderboardOptInUsers returns all Discord user IDs who have at least one opt-in in any guild.

func GetLeaderboardSnapDates

func GetLeaderboardSnapDates(lbType string) ([]string, error)

GetLeaderboardSnapDates returns all distinct snap_dates for a lb_type, newest first.

func GetLinks(userID string) []string

GetLinks will return a slice of bookmark links

func GetMiscSettingFlag

func GetMiscSettingFlag(userID string, key string) bool

GetMiscSettingFlag returns a Farmer sticky setting

func GetMiscSettingString

func GetMiscSettingString(userID string, key string) string

GetMiscSettingString returns a Farmer sticky setting

func GetMissionShipPrimary

func GetMissionShipPrimary(userID string) int

GetMissionShipPrimary returns a Farmer Mission Ship Primary

func GetMissionShipSecondary

func GetMissionShipSecondary(userID string) int

GetMissionShipSecondary returns a Farmer Mission Ship Secondary

func GetPing

func GetPing(userID string) bool

GetPing returns a Farmer's ping preference

func GetRecentCoopIDs

func GetRecentCoopIDs(userID string) []string

GetRecentCoopIDs returns the list of recently used coop IDs

func GetSlashPrivacyCommand

func GetSlashPrivacyCommand(cmd string) *discordgo.ApplicationCommand

GetSlashPrivacyCommand creates a new slash command for setting Egg, Inc name

func GetTokens

func GetTokens(userID string) int

GetTokens returns a Farmer's tokens

func GetUserGuilds

func GetUserGuilds(userID string) []string

GetUserGuilds returns all guild IDs the user belongs to.

func HandlePrivacyCommand

func HandlePrivacyCommand(s *discordgo.Session, i *discordgo.InteractionCreate)

HandlePrivacyCommand will handle the /privacy command

func HandleSetEggIncName

func HandleSetEggIncName(s *discordgo.Session, i *discordgo.InteractionCreate, isCoordinator func(*discordgo.Session, string) bool)

HandleSetEggIncName handles the /seteggincname command

func InsertSuspectMission

func InsertSuspectMission(arg InsertSuspectMissionParams) error

InsertSuspectMission records a suspect mission anomaly to the database.

func IsUltra

func IsUltra(userID string) bool

IsUltra will return if a player has joined an ultra contract in last 60 days

func PruneOlderLeaderboardStatsForPlayer

func PruneOlderLeaderboardStatsForPlayer(lbType, player, keepSnapDate string) error

PruneOlderLeaderboardStatsForPlayer removes older leaderboard stats for a specific player and type.

func RemoveCustomBanner

func RemoveCustomBanner(userID string, guildID string) error

RemoveCustomBanner deletes a user's custom banner from the database.

func RemoveGuildMembership

func RemoveGuildMembership(userID, guildID string)

RemoveGuildMembership removes a user from a guild.

func SetCustomBanner

func SetCustomBanner(userID string, guildID string, imageData []byte) error

SetCustomBanner saves a user's custom banner PNG bytes into the database.

func SetEggIncName

func SetEggIncName(userID string, eggIncName string)

SetEggIncName sets a Farmer Egg Inc name

func SetLastSeen

func SetLastSeen(userID string)

SetLastSeen updates the timestamp of the last time a farmer was added to a contract

func SetLaunchHistory

func SetLaunchHistory(userID string, setting bool)

SetLaunchHistory sets a Farmer Launch History

func SetLink(userID string, description string, guildID string, channelID string, messageID string)

SetLink will store a link for a user

func SetMiscSettingFlag

func SetMiscSettingFlag(userID string, key string, value bool)

SetMiscSettingFlag sets a key-value sticky setting

func SetMiscSettingString

func SetMiscSettingString(userID string, key string, value string)

SetMiscSettingString sets a key-value sticky setting

func SetMissionShipPrimary

func SetMissionShipPrimary(userID string, setting int)

SetMissionShipPrimary sets a Farmer Mission Ship Primary

func SetMissionShipSecondary

func SetMissionShipSecondary(userID string, setting int)

SetMissionShipSecondary sets a Farmer Mission Ship Secondary

func SetPing

func SetPing(userID string, ping bool)

SetPing sets a Farmer's ping preference

func SetTokens

func SetTokens(userID string, tokens int)

SetTokens sets a Farmer's tokens

func SetUltra

func SetUltra(userID string)

SetUltra sets a player to have joined an ultra contract

func SlashSetEggIncNameCommand

func SlashSetEggIncNameCommand(cmd string) *discordgo.ApplicationCommand

SlashSetEggIncNameCommand creates a new slash command for setting Egg, Inc name

func SyncCustomBanner

func SyncCustomBanner(userID string, guildID string, destPath string) bool

SyncCustomBanner checks if a custom banner exists in the database and is newer than the file on disk. If it is, it writes the image data from the database to the specified path.

func UpdateTimerMsg

func UpdateTimerMsg(id, channelID, msgID string)

UpdateTimerMsg updates the channel and message ID of a timer in the database.

func UpdateTimerState

func UpdateTimerState(id string, active bool)

UpdateTimerState updates the active state of a timer in the database.

func UpsertLeaderboardExclusion

func UpsertLeaderboardExclusion(guildID, userID, lbType string) error

UpsertLeaderboardExclusion adds a leaderboard exclusion record for a user in a guild.

func UpsertLeaderboardOptIn

func UpsertLeaderboardOptIn(guildID, userID, lbType string) error

UpsertLeaderboardOptIn adds a leaderboard opt-in record for a user in a guild.

func UpsertLeaderboardStat

func UpsertLeaderboardStat(lbType, player, gameName, snapDate string, value float64, details sql.NullString) error

UpsertLeaderboardStat saves one leaderboard snapshot row (upsert on primary key).

Types

type AddGuildMembershipParams

type AddGuildMembershipParams struct {
	UserID  string
	GuildID string
}

type CustomBanner

type CustomBanner struct {
	UserID    string
	GuildID   string
	ImageData []byte
	UpdatedAt time.Time
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DeleteAllLeaderboardExclusionsForUserInGuildParams

type DeleteAllLeaderboardExclusionsForUserInGuildParams struct {
	GuildID string
	UserID  string
}

type DeleteAllLeaderboardOptInsForUserInGuildParams

type DeleteAllLeaderboardOptInsForUserInGuildParams struct {
	GuildID string
	UserID  string
}

type DeleteCustomBannerParams

type DeleteCustomBannerParams struct {
	UserID  string
	GuildID string
}

type DeleteLeaderboardExclusionParams

type DeleteLeaderboardExclusionParams struct {
	GuildID string
	UserID  string
	LbType  string
}

type DeleteLeaderboardOptInParams

type DeleteLeaderboardOptInParams struct {
	GuildID string
	UserID  string
	LbType  string
}

type DeleteLeaderboardStatsForPlayerParams

type DeleteLeaderboardStatsForPlayerParams struct {
	Player string
	LbType string
}

type DeleteWatchParams

type DeleteWatchParams struct {
	UserID    string
	WatchType string
	TargetID  string
}

type Farmer

type Farmer struct {
	UserID               string    // Discord User ID
	EggIncName           string    // User's Egg Inc name
	Ping                 bool      // True/False
	Tokens               int       // Number of tokens this user wants
	LaunchChain          bool      // Launch History chain option
	MissionShipPrimary   int       // Launch Helper Ship Selection - Primary
	MissionShipSecondary int       // Launch Helper Ship Selection - Secondary
	UltraContract        time.Time // Date last Ultra contract was detected
	MiscSettingsFlag     map[string]bool
	MiscSettingsString   map[string]string
	Links                []Link // Array of Links
	LastUpdated          time.Time
	LastSeen             time.Time // Last time farmer was added to a contract
	DataPrivacy          bool      // User data privacy setting
}

Farmer struct to store user data

type FarmerGuildMembership

type FarmerGuildMembership struct {
	UserID  string
	GuildID string
}

type FarmerState

type FarmerState struct {
	ID    string
	Key   string
	Value sql.NullString
}

type GetCustomBannerParams

type GetCustomBannerParams struct {
	UserID  string
	GuildID string
}

type GetCustomBannerRow

type GetCustomBannerRow struct {
	ImageData []byte
	UpdatedAt time.Time
}

type GetEiIgnsByMiscStringParams

type GetEiIgnsByMiscStringParams struct {
	Column1 sql.NullString
	Value   sql.NullString
}

type GetIdsByMiscStringParams

type GetIdsByMiscStringParams struct {
	Column1 sql.NullString
	Value   sql.NullString
}

type GetLeaderboardExclusionsForUserRow

type GetLeaderboardExclusionsForUserRow struct {
	GuildID string
	LbType  string
}

func GetLeaderboardExclusionsForUser

func GetLeaderboardExclusionsForUser(userID string) ([]GetLeaderboardExclusionsForUserRow, error)

GetLeaderboardExclusionsForUser returns all (guild_id, lb_type) exclusion pairs for a given user.

type GetLeaderboardForSnapDateParams

type GetLeaderboardForSnapDateParams struct {
	LbType   string
	GuildID  string
	SnapDate string
}

type GetLeaderboardForSnapDateRow

type GetLeaderboardForSnapDateRow struct {
	Player   string
	GameName string
	Value    float64
	Details  sql.NullString
}

func GetLeaderboardForSnapDate

func GetLeaderboardForSnapDate(lbType, guildID, snapDate string) ([]GetLeaderboardForSnapDateRow, error)

GetLeaderboardForSnapDate returns all rows for a lb_type, guild_id and snap_date, ordered by value DESC.

type GetLeaderboardOptInsForGuildRow

type GetLeaderboardOptInsForGuildRow struct {
	UserID string
	LbType string
}

func GetLeaderboardOptInsForGuild

func GetLeaderboardOptInsForGuild(guildID string) ([]GetLeaderboardOptInsForGuildRow, error)

GetLeaderboardOptInsForGuild returns all (user_id, lb_type) pairs for a given guild.

type GetLeaderboardOptInsForUserRow

type GetLeaderboardOptInsForUserRow struct {
	GuildID string
	LbType  string
}

func GetLeaderboardOptInsForUser

func GetLeaderboardOptInsForUser(userID string) ([]GetLeaderboardOptInsForUserRow, error)

GetLeaderboardOptInsForUser returns all (guild_id, lb_type) pairs for a given user.

type GetLeaderboardStatForPlayerParams

type GetLeaderboardStatForPlayerParams struct {
	LbType string
	Player string
}

type GetLeaderboardStatForPlayerRow

type GetLeaderboardStatForPlayerRow struct {
	Player   string
	GameName string
	SnapDate string
	Value    float64
	Details  sql.NullString
}

func GetLeaderboardStatForPlayer

func GetLeaderboardStatForPlayer(lbType, player string) (GetLeaderboardStatForPlayerRow, error)

GetLeaderboardStatForPlayer returns the most recent stat for a player + lb_type.

type GetStatsForPlayerInGuildParams

type GetStatsForPlayerInGuildParams struct {
	Player  string
	GuildID string
}

type InsertLegacyFarmerstateParams

type InsertLegacyFarmerstateParams struct {
	ID    string
	Value sql.NullString
}

type InsertSuspectMissionParams

type InsertSuspectMissionParams struct {
	UserID           string
	MissionID        string
	Ship             int64
	Status           int64
	DurationType     int64
	MissionType      int64
	Level            int64
	Capacity         int64
	QualityBump      float64
	TargetArtifact   int64
	DurationSeconds  float64
	StartTimeDerived float64
	BaseSeconds      float64
	EventMultiplier  float64
}

type InsertTimerParams

type InsertTimerParams struct {
	ID                string
	UserID            string
	ChannelID         string
	MsgID             string
	Reminder          time.Time
	Message           string
	Duration          int64
	OriginalChannelID string
	OriginalMsgID     string
	Active            bool
}

type InsertWatchParams

type InsertWatchParams struct {
	UserID    string
	WatchType string
	TargetID  string
}

type LeaderboardExclusion

type LeaderboardExclusion struct {
	GuildID string
	UserID  string
	LbType  string
}

type LeaderboardOptin

type LeaderboardOptin struct {
	GuildID string
	UserID  string
	LbType  string
}

type LeaderboardStat

type LeaderboardStat struct {
	LbType   string
	Player   string
	GameName string
	SnapDate string
	Value    float64
	Details  sql.NullString
}

func GetStatsForPlayer

func GetStatsForPlayer(player string) ([]LeaderboardStat, error)

GetStatsForPlayer returns all leaderboard stats for a specific player across all types.

func GetStatsForPlayerInGuild

func GetStatsForPlayerInGuild(player, guildID string) ([]LeaderboardStat, error)

GetStatsForPlayerInGuild returns all leaderboard stats for a player in a specific guild.

type Link struct {
	Link      string    `json:"Link"`
	Timestamp time.Time `json:"Timestamp"`
}

Link will hold bookmark links

type PruneOlderLeaderboardStatsForPlayerParams

type PruneOlderLeaderboardStatsForPlayerParams struct {
	LbType   string
	Player   string
	SnapDate string
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) AddGuildMembership

func (q *Queries) AddGuildMembership(ctx context.Context, arg AddGuildMembershipParams) (int64, error)

func (*Queries) ClearExtraLegacyRecords

func (q *Queries) ClearExtraLegacyRecords(ctx context.Context) error

func (*Queries) DeleteAllLeaderboardExclusionsForUserInGuild

func (q *Queries) DeleteAllLeaderboardExclusionsForUserInGuild(ctx context.Context, arg DeleteAllLeaderboardExclusionsForUserInGuildParams) error

func (*Queries) DeleteAllLeaderboardOptInsForUserInGuild

func (q *Queries) DeleteAllLeaderboardOptInsForUserInGuild(ctx context.Context, arg DeleteAllLeaderboardOptInsForUserInGuildParams) error

func (*Queries) DeleteAllLeaderboardStatsForPlayerInGuild

func (q *Queries) DeleteAllLeaderboardStatsForPlayerInGuild(ctx context.Context) error

No-op since leaderboard_stats is now global.

func (*Queries) DeleteCustomBanner

func (q *Queries) DeleteCustomBanner(ctx context.Context, arg DeleteCustomBannerParams) error

func (*Queries) DeleteFarmerLegacyRecords

func (q *Queries) DeleteFarmerLegacyRecords(ctx context.Context, id string) error

func (*Queries) DeleteFarmerRecord

func (q *Queries) DeleteFarmerRecord(ctx context.Context, id string) error

func (*Queries) DeleteInactiveTimers

func (q *Queries) DeleteInactiveTimers(ctx context.Context) error

func (*Queries) DeleteLeaderboardExclusion

func (q *Queries) DeleteLeaderboardExclusion(ctx context.Context, arg DeleteLeaderboardExclusionParams) error

func (*Queries) DeleteLeaderboardOptIn

func (q *Queries) DeleteLeaderboardOptIn(ctx context.Context, arg DeleteLeaderboardOptInParams) error

func (*Queries) DeleteLeaderboardStatsForPlayer

func (q *Queries) DeleteLeaderboardStatsForPlayer(ctx context.Context, arg DeleteLeaderboardStatsForPlayerParams) error

func (*Queries) DeleteLegacyFarmerstate

func (q *Queries) DeleteLegacyFarmerstate(ctx context.Context, id string) error

func (*Queries) DeleteTimer

func (q *Queries) DeleteTimer(ctx context.Context, id string) error

func (*Queries) DeleteUserCustomBanners

func (q *Queries) DeleteUserCustomBanners(ctx context.Context, userID string) error

func (*Queries) DeleteUserGuildMemberships

func (q *Queries) DeleteUserGuildMemberships(ctx context.Context, userID string) error

func (*Queries) DeleteUserLeaderboardExclusions

func (q *Queries) DeleteUserLeaderboardExclusions(ctx context.Context, userID string) error

func (*Queries) DeleteUserLeaderboardOptIns

func (q *Queries) DeleteUserLeaderboardOptIns(ctx context.Context, userID string) error

func (*Queries) DeleteUserLeaderboardStats

func (q *Queries) DeleteUserLeaderboardStats(ctx context.Context, player string) error

func (*Queries) DeleteUserSuspectMissions

func (q *Queries) DeleteUserSuspectMissions(ctx context.Context, userID string) error

func (*Queries) DeleteUserTimers

func (q *Queries) DeleteUserTimers(ctx context.Context, userID string) error

func (*Queries) DeleteUserWatches

func (q *Queries) DeleteUserWatches(ctx context.Context, userID string) error

func (*Queries) DeleteWatch

func (q *Queries) DeleteWatch(ctx context.Context, arg DeleteWatchParams) error

func (*Queries) GetAllLegacyFarmerstate

func (q *Queries) GetAllLegacyFarmerstate(ctx context.Context) ([]FarmerState, error)

func (*Queries) GetAllWatches

func (q *Queries) GetAllWatches(ctx context.Context) ([]Watch, error)

func (*Queries) GetCustomBanner

func (q *Queries) GetCustomBanner(ctx context.Context, arg GetCustomBannerParams) (GetCustomBannerRow, error)

func (*Queries) GetCustomBannersForUser

func (q *Queries) GetCustomBannersForUser(ctx context.Context, userID string) ([]CustomBanner, error)

func (*Queries) GetEiIgnsByGuild

func (q *Queries) GetEiIgnsByGuild(ctx context.Context, guildID string) ([]interface{}, error)

func (*Queries) GetEiIgnsByMiscString

func (q *Queries) GetEiIgnsByMiscString(ctx context.Context, arg GetEiIgnsByMiscStringParams) ([]interface{}, error)

func (*Queries) GetGuildMembers

func (q *Queries) GetGuildMembers(ctx context.Context, guildID string) ([]string, error)

func (*Queries) GetIdsByMiscString

func (q *Queries) GetIdsByMiscString(ctx context.Context, arg GetIdsByMiscStringParams) ([]string, error)

func (*Queries) GetLatestLeaderboardSnapDate

func (q *Queries) GetLatestLeaderboardSnapDate(ctx context.Context, lbType string) (string, error)

Returns the most recent snap_date recorded for a given lb_type.

func (*Queries) GetLeaderboardExclusionsForUser

func (q *Queries) GetLeaderboardExclusionsForUser(ctx context.Context, userID string) ([]GetLeaderboardExclusionsForUserRow, error)

Returns all (guild_id, lb_type) exclusion pairs for a given user.

func (*Queries) GetLeaderboardForSnapDate

func (q *Queries) GetLeaderboardForSnapDate(ctx context.Context, arg GetLeaderboardForSnapDateParams) ([]GetLeaderboardForSnapDateRow, error)

Returns all rows for a given lb_type, guild_id, and snap_date, ordered by value descending.

func (*Queries) GetLeaderboardOptInUsers

func (q *Queries) GetLeaderboardOptInUsers(ctx context.Context) ([]string, error)

Returns all Discord user IDs who have at least one opt-in in any guild.

func (*Queries) GetLeaderboardOptInsForGuild

func (q *Queries) GetLeaderboardOptInsForGuild(ctx context.Context, guildID string) ([]GetLeaderboardOptInsForGuildRow, error)

Returns all (user_id, lb_type) pairs for a given guild.

func (*Queries) GetLeaderboardOptInsForUser

func (q *Queries) GetLeaderboardOptInsForUser(ctx context.Context, userID string) ([]GetLeaderboardOptInsForUserRow, error)

Returns all (guild_id, lb_type) pairs for a given user.

func (*Queries) GetLeaderboardSnapDates

func (q *Queries) GetLeaderboardSnapDates(ctx context.Context, lbType string) ([]string, error)

Returns all distinct snap_dates for a given lb_type, newest first.

func (*Queries) GetLeaderboardStatForPlayer

Returns the most recent stat row for a player + lb_type.

func (*Queries) GetLegacyFarmerstate

func (q *Queries) GetLegacyFarmerstate(ctx context.Context, id string) (FarmerState, error)

func (*Queries) GetStatsForPlayer

func (q *Queries) GetStatsForPlayer(ctx context.Context, player string) ([]LeaderboardStat, error)

Returns all leaderboard stats for a specific player across all types, newest first.

func (*Queries) GetStatsForPlayerInGuild

func (q *Queries) GetStatsForPlayerInGuild(ctx context.Context, arg GetStatsForPlayerInGuildParams) ([]LeaderboardStat, error)

Returns all leaderboard stats for a specific player in a specific guild.

func (*Queries) GetSuspectMissions

func (q *Queries) GetSuspectMissions(ctx context.Context, userID string) ([]SuspectMission, error)

func (*Queries) GetTimers

func (q *Queries) GetTimers(ctx context.Context) ([]Timer, error)

func (*Queries) GetTimersForUser

func (q *Queries) GetTimersForUser(ctx context.Context, userID string) ([]Timer, error)

func (*Queries) GetUserGuilds

func (q *Queries) GetUserGuilds(ctx context.Context, userID string) ([]string, error)

func (*Queries) GetUserIdFromEiIgn

func (q *Queries) GetUserIdFromEiIgn(ctx context.Context, value sql.NullString) (string, error)

func (*Queries) GetWatchesForUser

func (q *Queries) GetWatchesForUser(ctx context.Context, userID string) ([]Watch, error)

func (*Queries) InsertLegacyFarmerstate

func (q *Queries) InsertLegacyFarmerstate(ctx context.Context, arg InsertLegacyFarmerstateParams) (FarmerState, error)

func (*Queries) InsertSuspectMission

func (q *Queries) InsertSuspectMission(ctx context.Context, arg InsertSuspectMissionParams) error

func (*Queries) InsertTimer

func (q *Queries) InsertTimer(ctx context.Context, arg InsertTimerParams) error

func (*Queries) InsertWatch

func (q *Queries) InsertWatch(ctx context.Context, arg InsertWatchParams) error

func (*Queries) PruneOlderLeaderboardStatsForPlayer

func (q *Queries) PruneOlderLeaderboardStatsForPlayer(ctx context.Context, arg PruneOlderLeaderboardStatsForPlayerParams) error

Deletes older leaderboard stats for a player if RetainRecentOnly is true.

func (*Queries) RemoveGuildMembership

func (q *Queries) RemoveGuildMembership(ctx context.Context, arg RemoveGuildMembershipParams) error

func (*Queries) UpdateLegacyFarmerstate

func (q *Queries) UpdateLegacyFarmerstate(ctx context.Context, arg UpdateLegacyFarmerstateParams) (int64, error)

func (*Queries) UpdateTimerMsg

func (q *Queries) UpdateTimerMsg(ctx context.Context, arg UpdateTimerMsgParams) error

func (*Queries) UpdateTimerState

func (q *Queries) UpdateTimerState(ctx context.Context, arg UpdateTimerStateParams) error

func (*Queries) UpsertCustomBanner

func (q *Queries) UpsertCustomBanner(ctx context.Context, arg UpsertCustomBannerParams) error

func (*Queries) UpsertLeaderboardExclusion

func (q *Queries) UpsertLeaderboardExclusion(ctx context.Context, arg UpsertLeaderboardExclusionParams) error

func (*Queries) UpsertLeaderboardOptIn

func (q *Queries) UpsertLeaderboardOptIn(ctx context.Context, arg UpsertLeaderboardOptInParams) error

func (*Queries) UpsertLeaderboardStat

func (q *Queries) UpsertLeaderboardStat(ctx context.Context, arg UpsertLeaderboardStatParams) error

Inserts or replaces a leaderboard snapshot for (lb_type, player, snap_date).

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type RemoveGuildMembershipParams

type RemoveGuildMembershipParams struct {
	UserID  string
	GuildID string
}

type SuspectMission

type SuspectMission struct {
	UserID           string
	MissionID        string
	Ship             int64
	Status           int64
	DurationType     int64
	MissionType      int64
	Level            int64
	Capacity         int64
	QualityBump      float64
	TargetArtifact   int64
	DurationSeconds  float64
	StartTimeDerived float64
	BaseSeconds      float64
	EventMultiplier  float64
}

type Timer

type Timer struct {
	ID                string
	UserID            string
	ChannelID         string
	MsgID             string
	Reminder          time.Time
	Message           string
	Duration          int64
	OriginalChannelID string
	OriginalMsgID     string
	Active            bool
}

func GetAllTimers

func GetAllTimers() []Timer

GetAllTimers returns all timers from the database.

type UpdateLegacyFarmerstateParams

type UpdateLegacyFarmerstateParams struct {
	Value sql.NullString
	ID    string
}

type UpdateTimerMsgParams

type UpdateTimerMsgParams struct {
	ChannelID string
	MsgID     string
	ID        string
}

type UpdateTimerStateParams

type UpdateTimerStateParams struct {
	Active bool
	ID     string
}

type UpsertCustomBannerParams

type UpsertCustomBannerParams struct {
	UserID    string
	GuildID   string
	ImageData []byte
}

type UpsertLeaderboardExclusionParams

type UpsertLeaderboardExclusionParams struct {
	GuildID string
	UserID  string
	LbType  string
}

type UpsertLeaderboardOptInParams

type UpsertLeaderboardOptInParams struct {
	GuildID string
	UserID  string
	LbType  string
}

type UpsertLeaderboardStatParams

type UpsertLeaderboardStatParams struct {
	LbType   string
	Player   string
	GameName string
	SnapDate string
	Value    float64
	Details  sql.NullString
}

type UserPrivacyData

type UserPrivacyData struct {
	FarmerState           *Farmer                              `json:"farmer_state,omitempty"`
	GuildMemberships      []string                             `json:"guild_memberships,omitempty"`
	CustomBanners         []CustomBanner                       `json:"custom_banners,omitempty"`
	Timers                []Timer                              `json:"timers,omitempty"`
	SuspectMissions       []SuspectMission                     `json:"suspect_missions,omitempty"`
	LeaderboardStats      []LeaderboardStat                    `json:"leaderboard_stats,omitempty"`
	LeaderboardOptins     []GetLeaderboardOptInsForUserRow     `json:"leaderboard_optins,omitempty"`
	LeaderboardExclusions []GetLeaderboardExclusionsForUserRow `json:"leaderboard_exclusions,omitempty"`
	Watches               []Watch                              `json:"watches,omitempty"`
}

UserPrivacyData contains all information we store about a user

func GetFullUserData

func GetFullUserData(userID string) *UserPrivacyData

type Watch

type Watch struct {
	UserID    string
	WatchType string
	TargetID  string
	CreatedAt time.Time
}

func GetAllWatches

func GetAllWatches() []Watch

GetAllWatches returns all watches in the database.

func GetWatchesForUser

func GetWatchesForUser(userID string) []Watch

GetWatchesForUser returns all watches for a given user.

Jump to

Keyboard shortcuts

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