Documentation ¶
Index ¶
- type DB
- func (db *DB) ClearFlags() error
- func (db *DB) ClearScores() error
- func (db *DB) ClearTeams() error
- func (db *DB) CreateFlag(flag api.AdminFlagPost) (int64, error)
- func (db *DB) CreateScore(score api.AdminScorePost) (int64, error)
- func (db *DB) CreateTeam(team api.AdminTeamPost) (int64, error)
- func (db *DB) DeleteFlag(id int64) error
- func (db *DB) DeleteScore(id int64) error
- func (db *DB) DeleteTeam(id int64) error
- func (db *DB) GetConfig() (*api.ConfigPut, error)
- func (db *DB) GetCurrentSchema() (int, error)
- func (db *DB) GetFlag(id int64) (*api.AdminFlag, error)
- func (db *DB) GetFlags() ([]api.AdminFlag, error)
- func (db *DB) GetScore(id int64) (*api.AdminScore, error)
- func (db *DB) GetScoreboard() ([]api.ScoreboardEntry, error)
- func (db *DB) GetScores() ([]api.AdminScore, error)
- func (db *DB) GetTeam(id int64) (*api.AdminTeam, error)
- func (db *DB) GetTeamFlag(teamid int64, id int64) (*api.Flag, error)
- func (db *DB) GetTeamFlags(teamid int64) ([]api.Flag, error)
- func (db *DB) GetTeamForIP(ip net.IP) (*api.AdminTeam, error)
- func (db *DB) GetTeamPoints(teamid int64) (int64, error)
- func (db *DB) GetTeams() ([]api.AdminTeam, error)
- func (db *DB) GetTimeline() ([]api.TimelineEntry, error)
- func (db *DB) SubmitTeamFlag(teamid int64, flag api.FlagPost) (*api.Flag, *api.AdminFlag, error)
- func (db *DB) UpdateConfig(config api.ConfigPut) error
- func (db *DB) UpdateFlag(id int64, flag api.AdminFlagPut) error
- func (db *DB) UpdateScore(id int64, score api.AdminScorePut) error
- func (db *DB) UpdateTeam(id int64, team api.AdminTeamPut) error
- func (db *DB) UpdateTeamFlag(teamid int64, id int64, flag api.FlagPut) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
DB represents the Askgod database
func Connect ¶
func Connect(driver string, host string, username string, password string, database string, connections int, logger log15.Logger) (*DB, error)
Connect sets up the database connection and returns a DB struct
func (*DB) ClearFlags ¶
ClearFlags wipes all flag entries from the database
func (*DB) ClearScores ¶
ClearScores wipes all score entries from the database
func (*DB) ClearTeams ¶
ClearTeams wipes all team entries from the database
func (*DB) CreateFlag ¶
func (db *DB) CreateFlag(flag api.AdminFlagPost) (int64, error)
CreateFlag adds a new flag to the database
func (*DB) CreateScore ¶
func (db *DB) CreateScore(score api.AdminScorePost) (int64, error)
CreateScore adds a new score entry to the database
func (*DB) CreateTeam ¶
func (db *DB) CreateTeam(team api.AdminTeamPost) (int64, error)
CreateTeam adds a new team to the database
func (*DB) DeleteFlag ¶
DeleteFlag deletes a single flag from the database
func (*DB) DeleteScore ¶
DeleteScore deletes a single score entry from the database
func (*DB) DeleteTeam ¶
DeleteTeam deletes a single team from the database
func (*DB) GetCurrentSchema ¶
GetCurrentSchema returns the current DB schema version
func (*DB) GetScore ¶
func (db *DB) GetScore(id int64) (*api.AdminScore, error)
GetScore retrieves a single score entry from the database
func (*DB) GetScoreboard ¶
func (db *DB) GetScoreboard() ([]api.ScoreboardEntry, error)
GetScoreboard generates the current scoreboard
func (*DB) GetScores ¶
func (db *DB) GetScores() ([]api.AdminScore, error)
GetScores retrieves all the score entries from the database
func (*DB) GetTeamFlag ¶
GetTeamFlag retrieves a single score entry for the team
func (*DB) GetTeamFlags ¶
GetTeamFlags retrieves all the score entries for the team
func (*DB) GetTeamForIP ¶
GetTeamForIP retrieves a single team entry for the provided IP
func (*DB) GetTeamPoints ¶
GetTeamPoints returns the current total for the team
func (*DB) GetTimeline ¶
func (db *DB) GetTimeline() ([]api.TimelineEntry, error)
GetTimeline generates the current timeline
func (*DB) SubmitTeamFlag ¶
SubmitTeamFlag validates a submitted flag and adds it to the database
func (*DB) UpdateConfig ¶
UpdateConfig updates the configuration
func (*DB) UpdateFlag ¶
func (db *DB) UpdateFlag(id int64, flag api.AdminFlagPut) error
UpdateFlag updates an existing flag
func (*DB) UpdateScore ¶
func (db *DB) UpdateScore(id int64, score api.AdminScorePut) error
UpdateScore updates an existing score entry
func (*DB) UpdateTeam ¶
func (db *DB) UpdateTeam(id int64, team api.AdminTeamPut) error
UpdateTeam updates an existing team