Documentation ¶
Index ¶
- Variables
- type MongoBotConfigProvider
- func (b *MongoBotConfigProvider) Connect() error
- func (b *MongoBotConfigProvider) GetAllEnabledBotIDs() (botIDs []string)
- func (b *MongoBotConfigProvider) GetBotConfig(botID string) (botconfig.BotConfig, error)
- func (b *MongoBotConfigProvider) GetBotConfigCount() (uint64, error)
- func (b *MongoBotConfigProvider) IsConnected() bool
- func (b *MongoBotConfigProvider) StoreBotConfig(data *botconfig.BotConfig) error
Constants ¶
This section is empty.
Variables ¶
var COLLECTION_BOTS = "bots"
var FIELD_ENABLED = "enabled"
var FIELD_ID = "id"
Functions ¶
This section is empty.
Types ¶
type MongoBotConfigProvider ¶
type MongoBotConfigProvider struct {
// contains filtered or unexported fields
}
MongoBotConfigProvider represents a config provider using a MongoDB
func NewBackend ¶
func NewBackend(url string, db string) (*MongoBotConfigProvider, error)
NewBackend creates a new Mongo Backend
func (*MongoBotConfigProvider) Connect ¶
func (b *MongoBotConfigProvider) Connect() error
Connect initializes the MongoDBBackend Client by using the appropriate Mongo functions. In addition it checks its collections and creates indices if necessary. This method must be called before the Mongo Backend can be used.
func (*MongoBotConfigProvider) GetAllEnabledBotIDs ¶
func (b *MongoBotConfigProvider) GetAllEnabledBotIDs() (botIDs []string)
GetAllEnabledBotIDs returns only bot IDs for bots which are enabled It returns nil if something went wrong
func (*MongoBotConfigProvider) GetBotConfig ¶
func (b *MongoBotConfigProvider) GetBotConfig(botID string) (botconfig.BotConfig, error)
GetBotConfig retrieves the bot configuration data for the given id
func (*MongoBotConfigProvider) GetBotConfigCount ¶
func (b *MongoBotConfigProvider) GetBotConfigCount() (uint64, error)
GetBotConfigCount returns the number of stored bot configurations
func (*MongoBotConfigProvider) IsConnected ¶
func (b *MongoBotConfigProvider) IsConnected() bool
IsConnected indicates if the MongoBotConfigProvider actually has a connection to a Mongo server
func (*MongoBotConfigProvider) StoreBotConfig ¶
func (b *MongoBotConfigProvider) StoreBotConfig(data *botconfig.BotConfig) error
StoreBotConfig stores new match data