Documentation ¶
Overview ¶
Package store persists game data.
Index ¶
- func OpenPg(rawURL string) (*sql.DB, error)
- type MutMap
- type Postgres
- func (s *Postgres) Close()
- func (s *Postgres) CreateTeam(teamID string) (server.Team, error)
- func (s *Postgres) FindByID(teamID string) (server.Team, error)
- func (s *Postgres) GetLeaderboard() (server.Leaderboard, error)
- func (s *Postgres) RecordClicks(teamID string, count int64) (server.Team, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MutMap ¶
type MutMap struct {
// contains filtered or unexported fields
}
MutMap is an in memory team score store.
func (*MutMap) Close ¶
func (mm *MutMap) Close()
Close closes the store (but MutMap has no connection)
func (*MutMap) CreateTeam ¶
CreateTeam creates a new team, an error means the ID is taken.
func (*MutMap) GetLeaderboard ¶
func (mm *MutMap) GetLeaderboard() (server.Leaderboard, error)
GetLeaderboard returns the highest scoring teams.
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
Postgres is a postrges backed team score store.
func NewPostgres ¶
NewPostgres creates a Postgres backed by the given table and DB. The table is created if it does not exist.
func (*Postgres) Close ¶
func (s *Postgres) Close()
Close closes the store (its database connection)
func (*Postgres) CreateTeam ¶
CreateTeam creates a new team, an error means the ID is taken.
func (*Postgres) GetLeaderboard ¶
func (s *Postgres) GetLeaderboard() (server.Leaderboard, error)
GetLeaderboard returns the highest scoring teams.
Click to show internal directories.
Click to hide internal directories.