Documentation ¶
Overview ¶
Package store provides functionality for communicating with the backend database. The database must implement the Store interface.
Index ¶
Constants ¶
View Source
const ( // MigrateUp Fully upgrades the schema MigrateUp = iota // MigrateDn Fully downgrades the schema MigrateDn )
Variables ¶
View Source
var ( // ErrNoResult is returned on successful queries which return no rows ErrNoResult = errors.New("No results found") // ErrDuplicate is returned when a duplicate row value is attempted to be inserted ErrDuplicate = errors.New("Duplicate entity") )
Functions ¶
This section is empty.
Types ¶
type BanStore ¶ added in v0.1.8
type BanStore interface { GetBanBySteamID(ctx context.Context, steamID steamid.SID64, full bool, b *model.BannedPerson) error GetBanByBanID(ctx context.Context, banID uint64, full bool, b *model.BannedPerson) error GetAppeal(ctx context.Context, banID uint64, a *model.Appeal) error SaveAppeal(ctx context.Context, appeal *model.Appeal) error SaveBan(ctx context.Context, ban *model.Ban) error GetBanNet(ctx context.Context, ip net.IP) ([]model.BanNet, error) SaveBanNet(ctx context.Context, banNet *model.BanNet) error DropBanNet(ctx context.Context, ban *model.BanNet) error DropBan(ctx context.Context, ban *model.Ban) error GetExpiredBans(ctx context.Context) ([]model.Ban, error) GetBans(ctx context.Context, o *QueryFilter) ([]model.BannedPerson, error) GetBansOlderThan(ctx context.Context, o *QueryFilter, t time.Time) ([]model.Ban, error) GetExpiredNetBans(ctx context.Context) ([]model.BanNet, error) Import(ctx context.Context, root string) error GetBanASN(ctx context.Context, asNum int64, banASN *model.BanASN) error SaveBanASN(ctx context.Context, banASN *model.BanASN) error DropBanASN(ctx context.Context, ban *model.BanASN) error }
type FilterStore ¶ added in v0.1.8
type MigrationStore ¶ added in v0.1.8
type MigrationStore interface {
Migrate(action MigrationAction) error
}
type NetworkStore ¶ added in v0.1.8
type NetworkStore interface { InsertBlockListData(ctx context.Context, d *ip2location.BlockListData) error GetASNRecordByIP(ctx context.Context, ip net.IP, r *ip2location.ASNRecord) error GetASNRecordsByNum(ctx context.Context, asNum int64) (ip2location.ASNRecords, error) GetLocationRecord(ctx context.Context, ip net.IP, l *ip2location.LocationRecord) error GetProxyRecord(ctx context.Context, ip net.IP, l *ip2location.ProxyRecord) error GetPersonIPHistory(ctx context.Context, sid steamid.SID64) ([]model.PersonIPRecord, error) }
type PersonStore ¶ added in v0.1.8
type PersonStore interface { DropPerson(ctx context.Context, steamID steamid.SID64) error SavePerson(ctx context.Context, person *model.Person) error GetPersonBySteamID(ctx context.Context, sid steamid.SID64, p *model.Person) error GetPeople(ctx context.Context, qf *QueryFilter) ([]model.Person, error) GetOrCreatePersonBySteamID(ctx context.Context, sid steamid.SID64, p *model.Person) error GetPersonByDiscordID(ctx context.Context, did string, p *model.Person) error AddPersonIP(ctx context.Context, p *model.Person, ip string) error GetIPHistory(ctx context.Context, sid64 steamid.SID64) ([]model.PersonIPRecord, error) GetExpiredProfiles(ctx context.Context, limit int) ([]model.Person, error) }
type QueryFilter ¶
type QueryFilter struct { Offset uint64 `json:"offset" uri:"offset" binding:"gte=0"` Limit uint64 `json:"limit" uri:"limit" binding:"gte=0,lte=1000"` SortDesc bool `json:"desc" uri:"desc"` Query string `json:"query" uri:"query"` OrderBy string `json:"order_by" uri:"order_by"` }
QueryFilter provides a structure for common query parameters
func NewQueryFilter ¶
func NewQueryFilter(query string) *QueryFilter
type ServerStore ¶ added in v0.1.8
type ServerStore interface { GetServer(ctx context.Context, serverID int64, s *model.Server) error GetServers(ctx context.Context, includeDisabled bool) ([]model.Server, error) GetServerByName(ctx context.Context, serverName string, s *model.Server) error SaveServer(ctx context.Context, server *model.Server) error DropServer(ctx context.Context, serverID int64) error }
type StatStore ¶ added in v0.1.8
type StatStore interface { GetStats(ctx context.Context, s *model.Stats) error GetChatHistory(ctx context.Context, sid64 steamid.SID64, limit int) ([]logparse.SayEvt, error) FindLogEvents(ctx context.Context, opts model.LogQueryOpts) ([]model.ServerEvent, error) BatchInsertServerLogs(ctx context.Context, logs []model.ServerEvent) error }
type Store ¶ added in v0.1.8
type Store interface { BanStore DemoStore FilterStore MigrationStore NetworkStore PersonStore ServerStore StatStore io.Closer }
Store defines our composite store interface encapsulating all store interfaces
Click to show internal directories.
Click to hide internal directories.