Documentation
¶
Index ¶
- Constants
- type Bot
- type Config
- type DB
- func (db *DB) DeleteGuildKey(ctx context.Context, guildID discord.GuildID, key string) error
- func (db *DB) DeleteGuildUserKey(ctx context.Context, guildID discord.GuildID, userID discord.UserID, ...) error
- func (db *DB) DeleteUserKey(ctx context.Context, userID discord.UserID, key string) error
- func (db *DB) Get(v any, sql string, args ...any) error
- func (db *DB) GetContext(ctx context.Context, v any, sql string, args ...any) error
- func (db *DB) GetGuildBool(ctx context.Context, guildID discord.GuildID, key string) (val bool, err error)
- func (db *DB) GetGuildInt(ctx context.Context, guildID discord.GuildID, key string) (val int64, err error)
- func (db *DB) GetGuildString(ctx context.Context, guildID discord.GuildID, key string) (val string, err error)
- func (db *DB) GetGuildUserBool(ctx context.Context, guildID discord.GuildID, userID discord.UserID, ...) (val bool, err error)
- func (db *DB) GetGuildUserInt(ctx context.Context, guildID discord.GuildID, userID discord.UserID, ...) (val int64, err error)
- func (db *DB) GetGuildUserString(ctx context.Context, guildID discord.GuildID, userID discord.UserID, ...) (val string, err error)
- func (db *DB) GetUserBool(ctx context.Context, userID discord.UserID, key string) (val bool, err error)
- func (db *DB) GetUserInt(ctx context.Context, userID discord.UserID, key string) (val int64, err error)
- func (db *DB) GetUserString(ctx context.Context, userID discord.UserID, key string) (val string, err error)
- func (db *DB) Migrator() MigratorInterface
- func (db *DB) Scheduler() SchedulerInterface
- func (db *DB) Select(v any, sql string, args ...any) error
- func (db *DB) SelectContext(ctx context.Context, v any, sql string, args ...any) error
- func (db *DB) SetGuildBool(ctx context.Context, guildID discord.GuildID, key string, val bool) error
- func (db *DB) SetGuildInt(ctx context.Context, guildID discord.GuildID, key string, val int64) error
- func (db *DB) SetGuildString(ctx context.Context, guildID discord.GuildID, key, val string) error
- func (db *DB) SetGuildUserBool(ctx context.Context, guildID discord.GuildID, userID discord.UserID, ...) error
- func (db *DB) SetGuildUserInt(ctx context.Context, guildID discord.GuildID, userID discord.UserID, ...) error
- func (db *DB) SetGuildUserString(ctx context.Context, guildID discord.GuildID, userID discord.UserID, ...) error
- func (db *DB) SetUserBool(ctx context.Context, userID discord.UserID, key string, val bool) error
- func (db *DB) SetUserInt(ctx context.Context, userID discord.UserID, key string, val int64) error
- func (db *DB) SetUserString(ctx context.Context, userID discord.UserID, key, val string) error
- type Event
- type Migrator
- type MigratorInterface
- type Scheduler
- type SchedulerInterface
Constants ¶
View Source
const ErrSchemaAlreadyExists = errors.Sentinel("a schema with that name already has migrations added")
View Source
const ErrUnknownEvent = errors.Sentinel("unknown event type")
View Source
const Reschedule = errors.Sentinel("reschedule event")
Return Reschedule if the event should be rescheduled (offset by the duration returned from Offset)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config interface { GetGuildString(ctx context.Context, guildID discord.GuildID, key string) (val string, err error) GetGuildBool(ctx context.Context, guildID discord.GuildID, key string) (val bool, err error) GetGuildInt(ctx context.Context, guildID discord.GuildID, key string) (val int64, err error) SetGuildString(ctx context.Context, guildID discord.GuildID, key, val string) error SetGuildBool(ctx context.Context, guildID discord.GuildID, key string, val bool) error SetGuildInt(ctx context.Context, guildID discord.GuildID, key string, val int64) error DeleteGuildKey(ctx context.Context, guildID discord.GuildID, key string) error GetUserString(ctx context.Context, userID discord.UserID, key string) (val string, err error) GetUserBool(ctx context.Context, userID discord.UserID, key string) (val bool, err error) GetUserInt(ctx context.Context, userID discord.UserID, key string) (val int64, err error) SetUserString(ctx context.Context, userID discord.UserID, key, val string) error SetUserBool(ctx context.Context, userID discord.UserID, key string, val bool) error SetUserInt(ctx context.Context, userID discord.UserID, key string, val int64) error DeleteUserKey(ctx context.Context, userID discord.UserID, key string) error GetGuildUserString(ctx context.Context, guildID discord.GuildID, userID discord.UserID, key string) (val string, err error) GetGuildUserBool(ctx context.Context, guildID discord.GuildID, userID discord.UserID, key string) (val bool, err error) GetGuildUserInt(ctx context.Context, guildID discord.GuildID, userID discord.UserID, key string) (val int64, err error) SetGuildUserString(ctx context.Context, guildID discord.GuildID, userID discord.UserID, key, val string) error SetGuildUserBool(ctx context.Context, guildID discord.GuildID, userID discord.UserID, key string, val bool) error SetGuildUserInt(ctx context.Context, guildID discord.GuildID, userID discord.UserID, key string, val int64) error DeleteGuildUserKey(ctx context.Context, guildID discord.GuildID, userID discord.UserID, key string) error }
type DB ¶
func (*DB) DeleteGuildKey ¶
func (*DB) DeleteGuildUserKey ¶
func (*DB) DeleteUserKey ¶
func (*DB) GetContext ¶
func (*DB) GetGuildBool ¶
func (*DB) GetGuildInt ¶
func (*DB) GetGuildString ¶
func (*DB) GetGuildUserBool ¶
func (*DB) GetGuildUserInt ¶
func (*DB) GetGuildUserString ¶
func (*DB) GetUserBool ¶
func (*DB) GetUserInt ¶
func (*DB) GetUserString ¶
func (*DB) Migrator ¶
func (db *DB) Migrator() MigratorInterface
func (*DB) Scheduler ¶
func (db *DB) Scheduler() SchedulerInterface
func (*DB) SelectContext ¶
func (*DB) SetGuildBool ¶
func (*DB) SetGuildInt ¶
func (*DB) SetGuildString ¶
func (*DB) SetGuildUserBool ¶
func (*DB) SetGuildUserInt ¶
func (*DB) SetGuildUserString ¶
func (*DB) SetUserBool ¶
func (*DB) SetUserInt ¶
type Event ¶
type Event interface { Execute(ctx context.Context, id int64, bot *Bot) error Offset() time.Duration }
Event is any event that can be scheduled. Execute is called when the event is due to fire, Offset is called to determine how much to move the event.
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator manages database migrations. Each module should use its own separate database schema, to avoid conflicting with other modules. All modules should use the database independently from each other (no cross-schema relations), even though they use the same connection pool.
func (*Migrator) AddMigrations ¶
func (m *Migrator) AddMigrations(schema string, src migrate.MigrationSource) error
type MigratorInterface ¶
type MigratorInterface interface { AddMigrations(schema string, src migrate.MigrationSource) error Migrate() error }
Click to show internal directories.
Click to hide internal directories.