Documentation ¶
Index ¶
- Constants
- Variables
- func BuildURLForID(id string) (string, error)
- func BuildURLForName(name string) (string, error)
- func DescribeGames(games []Game) ([]string, []string)
- func Exit(err error)
- func GenerateMessage(games []Game, filterForSales bool) string
- func SetupRestAPI(host string, port int, debug bool) *http.Server
- type Client
- type ClientType
- type Database
- func (database *Database) AddGame(game Game) error
- func (database *Database) AddGameToUser(gameID string, clientID string, clientType ClientType) error
- func (database *Database) AddGames(games []Game) error
- func (database *Database) AddUser(client Client) error
- func (database *Database) Close()
- func (database *Database) DeleteGame(id string) error
- func (database *Database) DeleteGameFromUser(gameID string, clientID string, clientType ClientType) error
- func (database *Database) GetGame(id string) (game Game, err error)
- func (database *Database) GetGames() (games []Game, err error)
- func (database *Database) GetGamesForUser(clientID string, clientType ClientType, requestType RequestType) (games []Game, e error)
- func (database *Database) GetIDByGameName(name string) (id string, err error)
- func (database *Database) GetUsers(clientType ClientType) ([]string, error)
- type Game
- type Notifier
- type NotifierClient
- type NotifierMessage
- type RequestType
- type StorableClient
- type Updater
Constants ¶
View Source
const ( All = iota Sale )
View Source
const TimeFormat = "15:04"
Variables ¶
View Source
var SearchByID = searchByID
View Source
var SearchByName = searchByName
to be mocked in tests
View Source
var Version = "0.0.1"
Functions ¶
func BuildURLForID ¶
func BuildURLForName ¶
func DescribeGames ¶
func GenerateMessage ¶
Types ¶
type Client ¶
type Client interface { Type() ClientType Subscriptions() []string ID() string Storable() StorableClient AddSubscription(subscription string) }
func NewTelegramClient ¶
type ClientType ¶
type ClientType int
const (
Telegram ClientType = iota
)
func GetClientType ¶
func GetClientType(str string) (ClientType, error)
GetClientType takes source string and returns parsed type and error. if failed, then returns error and -1 as ClientType
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func NewDatabase ¶
func NewDatabase() *Database
func (*Database) AddGameToUser ¶
func (database *Database) AddGameToUser(gameID string, clientID string, clientType ClientType) error
func (*Database) DeleteGame ¶
func (*Database) DeleteGameFromUser ¶
func (database *Database) DeleteGameFromUser(gameID string, clientID string, clientType ClientType) error
func (*Database) GetGamesForUser ¶
func (database *Database) GetGamesForUser(clientID string, clientType ClientType, requestType RequestType) (games []Game, e error)
func (*Database) GetIDByGameName ¶
type Notifier ¶
type Notifier struct { // Events are pushed to this channel by the main events-gathering routine Notifier chan NotifierMessage // contains filtered or unexported fields }
func NewNotifier ¶
func NewNotifier() *Notifier
func (*Notifier) NotifyUser ¶
func (notifier *Notifier) NotifyUser(clientType ClientType, notif structs.UserNotification) error
type NotifierClient ¶
type NotifierClient struct { Destination ClientType Channel chan []byte }
type NotifierMessage ¶
type NotifierMessage struct { Destination ClientType Message []byte }
type RequestType ¶
type RequestType int
func GetRequestType ¶
func GetRequestType(str string) (RequestType, error)
type StorableClient ¶
type StorableClient struct {
Subscriptions []string `json:"subs"`
}
Click to show internal directories.
Click to hide internal directories.