Documentation ¶
Index ¶
- Variables
- type Database
- type MemoryDatabase
- func (m *MemoryDatabase) Connect() error
- func (m *MemoryDatabase) DeleteServerSettings(guildId string) error
- func (m *MemoryDatabase) Disconnect() error
- func (m *MemoryDatabase) ReadServerSettings(guildId string) (models.ServerSettings, error)
- func (m *MemoryDatabase) UpdateServerSettings(settings *models.ServerSettings) error
- type MongoDb
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDataNotFound = errors.New("database: row or document data not found")
ErrDataNotFound is a reusable error that can be used by different database implementations to denote that a row or document was not found.
Functions ¶
This section is empty.
Types ¶
type MemoryDatabase ¶
type MemoryDatabase struct { // Aternos discord cookie (ATERNOS_SESSION). SessionCookie string // Aternos server cookie (ATERNOS_SERVER). ServerCookie string }
MemoryDatabase is a simple in-memory database. Useful if you just want to self-host a bot for one discord server.
func NewInMemory ¶
func NewInMemory(session string, server string) *MemoryDatabase
func (*MemoryDatabase) Connect ¶
func (m *MemoryDatabase) Connect() error
func (*MemoryDatabase) DeleteServerSettings ¶ added in v0.2.2
func (m *MemoryDatabase) DeleteServerSettings(guildId string) error
func (*MemoryDatabase) Disconnect ¶
func (m *MemoryDatabase) Disconnect() error
func (*MemoryDatabase) ReadServerSettings ¶ added in v0.2.2
func (m *MemoryDatabase) ReadServerSettings(guildId string) (models.ServerSettings, error)
func (*MemoryDatabase) UpdateServerSettings ¶ added in v0.2.2
func (m *MemoryDatabase) UpdateServerSettings(settings *models.ServerSettings) error
type MongoDb ¶
type MongoDb struct { // MongoDB's connection URI string. ConnectionURI string // Name of the database to use. // Defaults to `aternos-discord-bot` DatabaseName string // Connection timeout. // // Defaults to 10 seconds. ConnectionTimeout time.Duration // contains filtered or unexported fields }
func (*MongoDb) DeleteServerSettings ¶ added in v0.2.2
func (*MongoDb) Disconnect ¶
func (*MongoDb) ReadServerSettings ¶ added in v0.2.2
func (db *MongoDb) ReadServerSettings(guildId string) (models.ServerSettings, error)
func (*MongoDb) UpdateServerSettings ¶ added in v0.2.2
func (db *MongoDb) UpdateServerSettings(settings *models.ServerSettings) error
Click to show internal directories.
Click to hide internal directories.