storage

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2018 License: MIT Imports: 2 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountsStore

type AccountsStore interface {
	All(*[]types.Account) error
	GetByDiscordGuild(snowflake string, account *types.Account) error
	GetByServerKey(serverKey string, account *types.Account) error
	UpsertBase(types.BaseAccount) error
	Remove(snowflake string) error

	AddServer(snowflake string, server types.Server) error
	UpdateServer(snowflake string, server types.Server) error
	RemoveServer(snowflake, serverKey string) error

	AddClan(serverKey string, clan types.Clan) error
	RemoveClan(serverKey, clanTag string) error
	SetClans(serverKey string, clans []types.Clan) error
}

AccountsStore is for accounts storage

type ChatsStore

type ChatsStore interface {
	Log(types.ChatMessage) error
	GetNext(serverKey string, ChatMessage *types.ChatMessage) error
}

ChatsStore is for logging chat

type DiscordAuthsStore

type DiscordAuthsStore interface {
	Get(discordName string, da *types.DiscordAuth) error
	GetSnowflake(snowflake string, da *types.DiscordAuth) error
	Upsert(types.DiscordAuth) error
	Remove(types.SteamInfo) error
}

DiscordAuthsStore is for accessing the discord -> user authentications in the store.

Upsert created or updates a discord auth

Remove removes a discord auth

type RaidAlertsStore

type RaidAlertsStore interface {
	GetReady(*[]types.RaidAlert) error
	AddInfo(alertIn time.Duration, ed types.EntityDeath) error
	Remove(types.RaidAlert) error
}

RaidAlertsStore is for accessing raid information. The raid information comes in as types.EntityDeath and comes out as types.RaidAlert

GetReady gets raid alerts that are ready to alert

AddInfo adds or updated raid information to a raid alert

Remove deletes a raid alert

type Storage

type Storage interface {
	Copy() Storage
	Close()
	Init()
	Accounts() AccountsStore
	Users() UsersStore
	Chats() ChatsStore
	DiscordAuths() DiscordAuthsStore
	RaidAlerts() RaidAlertsStore
}

Storage is a complete implementation of the data store for users, clans, discord auth requests, raid alerts, and chats.

Copy creates a new DB connection. Should always close the connection when you're done with it.

Close closes the session

Init creates indexes, and should always be called when Poundbot first starts

type UsersStore

type UsersStore interface {
	Get(steamID uint64, u *types.User) error
	UpsertBase(baseUser types.BaseUser) error
}

UsersStore is for accessing the user store.

Get gets a user from store.

UpsertBase updates or creats a user in the store

RemoveClan removes a clan tag from all users e.g. when a clan is removed.

RemoveClansNotIn is used for removing all clan tags not in the provided list from all users in the data store.

SetClanIn sets the clan tag on all users who have the provided steam IDs.

Directories

Path Synopsis
Code generated by mockery v1.0.0.
Code generated by mockery v1.0.0.

Jump to

Keyboard shortcuts

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