Documentation ¶
Index ¶
- Constants
- type RoomSubscriptionMessage
- type Storage
- func (s *Storage) AddGamesToRoom(roomID, bggUser string, games []bggclient.Game) error
- func (s *Storage) GetGamesForRoom(roomID string) ([]bggclient.Game, error)
- func (s *Storage) GetUserVotes(roomID string) (VoteResult, error)
- func (s *Storage) ResetRoomVotes(roomID string) error
- func (s *Storage) SetExpire(roomID string)
- func (s *Storage) SetUserVotes(roomID, user string, votes, vetoes []string) error
- func (s *Storage) SubscribeToRoomInfo(roomID string, watchFn func(RoomSubscriptionMessage)) func() error
- type UpdateType
- type VoteResult
Constants ¶
View Source
const ( UpdateTypeAddedGames UpdateType = "addedGamesUpdate" UpdateTypeAddedVotes = "addedVotesUpdate" UpdateTypeResetVotes = "resetVotesUpdate" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RoomSubscriptionMessage ¶
type RoomSubscriptionMessage struct { Type UpdateType `json:"type"` Games []bggclient.Game `json:"games"` Votes []string `json:"votes"` Vetoes []string `json:"vetoes"` User string `json:"user"` }
RoomSubscriptionMessage represents a message for when a room is updated
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func (*Storage) AddGamesToRoom ¶
AddGamesToRoom takes a adds an hash a set of games to a hash keyed by the user
func (*Storage) GetGamesForRoom ¶
GetGamesForRom retrieves all of the games for a room
func (*Storage) GetUserVotes ¶
func (s *Storage) GetUserVotes(roomID string) (VoteResult, error)
GetUserVotes returns a the vote result for a user
func (*Storage) ResetRoomVotes ¶
ResetRoomVotes removes all current votes for a room
func (*Storage) SetUserVotes ¶
SetUserVotes sets the votes and vetoes for a user
func (*Storage) SubscribeToRoomInfo ¶
func (s *Storage) SubscribeToRoomInfo(roomID string, watchFn func(RoomSubscriptionMessage)) func() error
SubscribeToRoomInfo sets up a subscription to updates for a room, calling the watchFn whenever an update is published
type UpdateType ¶
type UpdateType string
UpdateType represents a specific type of update for room subscriptions
Click to show internal directories.
Click to hide internal directories.