Documentation
¶
Index ¶
- Constants
- Variables
- type BoltStorage
- func (bs *BoltStorage) GetGuildConf(guildID string) (*models.Conf, error)
- func (bs *BoltStorage) NewGuild(g *discordgo.GuildCreate) (*models.Conf, error)
- func (bs *BoltStorage) NewGuildConf(guildID string) (*models.Conf, error)
- func (bs *BoltStorage) SaveGuildConf(gc *models.Conf) error
- func (bs *BoltStorage) UpdateGuildInfo(g *discordgo.GuildCreate) error
Constants ¶
View Source
const ( ConfKey = "conf" InfoKey = "info" UsersBucket = "users" GuildsBucket = "guilds" )
Various constant keys and bucket names
Variables ¶
View Source
var ( // ErrGuildNotFound is returned when the guild was not found in the bolt db ErrGuildNotFound = errors.New("guild not found") // ErrGuildsBucketNotFound is returned when the guilds bucket can't be found ErrGuildsBucketdNotFound = errors.New("guilds bucket not found") // ErrConfNotFound is returned when the guild's conf was not found in the bolt db ErrConfNotFound = errors.New("guild conf not found") )
Functions ¶
This section is empty.
Types ¶
type BoltStorage ¶ added in v0.2.0
type BoltStorage struct {
// contains filtered or unexported fields
}
BoltStorage is
func NewBoltStorage ¶ added in v0.2.0
NewBoltStorage will initiate a new bolt storage backend with the appropriate buckets, path and permissions.
func (*BoltStorage) GetGuildConf ¶ added in v0.2.0
func (bs *BoltStorage) GetGuildConf(guildID string) (*models.Conf, error)
GetGuildConf will attempt to fetch the guild configuration for a given ID.
func (*BoltStorage) NewGuild ¶ added in v0.2.0
func (bs *BoltStorage) NewGuild(g *discordgo.GuildCreate) (*models.Conf, error)
func (*BoltStorage) NewGuildConf ¶ added in v0.2.0
func (bs *BoltStorage) NewGuildConf(guildID string) (*models.Conf, error)
NewGuildConf will create a new nested bucket with the guild ID, and will put the conf in the `conf` key.
func (*BoltStorage) SaveGuildConf ¶ added in v0.2.0
func (bs *BoltStorage) SaveGuildConf(gc *models.Conf) error
SaveGuildConf will save the guild conf to the appropriate bucket Note that this can fail in the event of manual tampering with the guild conf, for example removing its ID or setting it to empty string before calling this method.
func (*BoltStorage) UpdateGuildInfo ¶ added in v0.2.0
func (bs *BoltStorage) UpdateGuildInfo(g *discordgo.GuildCreate) error
Click to show internal directories.
Click to hide internal directories.