mongobotconfigprovider

package
v0.0.0-...-b146d40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var COLLECTION_BOTS = "bots"
View Source
var FIELD_ENABLED = "enabled"
View Source
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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL