Documentation ¶
Overview ¶
Package modelsx provides extensions for the models package.
Index ¶
- Constants
- func DeleteChannel(ctx context.Context, exec boil.ContextExecutor, id int64) error
- func DeleteCommandInfo(ctx context.Context, exec boil.ContextExecutor, info *models.CommandInfo) (repeated *models.RepeatedCommand, scheduled *models.ScheduledCommand, ...)
- func FindCommand(ctx context.Context, exec boil.Executor, id int64, name string, forUpdate bool) (info *models.CommandInfo, commandMsg null.String, found bool, err error)
- func ListActiveChannels(ctx context.Context, exec boil.Executor, botName string) ([]string, error)
- func ModelToToken(tt *models.TwitchToken) *oauth2.Token
- func NewChannel(twitchID int64, name, displayName string, botName string) *models.Channel
- func TokenToModel(tok *oauth2.Token, id int64, botName null.String, scopes []string) *models.TwitchToken
- func TokenToModelWithoutPreservedColumns(tok *oauth2.Token, id int64) *models.TwitchToken
- func UpsertToken(ctx context.Context, exec boil.ContextExecutor, tt *models.TwitchToken) error
- func UpsertTokenWithoutPreservedColumns(ctx context.Context, exec boil.ContextExecutor, tt *models.TwitchToken) error
Constants ¶
const DefaultPrefix = "!"
DefaultPrefix is the default prefix inserted for new channels. The default prefix is not NULL, as changing it based on some config would break users who had previously been using the original prefix.
Variables ¶
This section is empty.
Functions ¶
func DeleteChannel ¶
DeleteChannel deletes a channel and every row in every table which references it. Must be done in a transaction, as the steps it takes are extremely likely to voilate constraints.
Ensure other state (like repeats) are refreshed after using this function (or otherwise do not take effect if their data is not found).
Must be kept in sync with migrations to keep this effective.
func DeleteCommandInfo ¶
func DeleteCommandInfo(ctx context.Context, exec boil.ContextExecutor, info *models.CommandInfo) (repeated *models.RepeatedCommand, scheduled *models.ScheduledCommand, err error)
DeleteCommandInfo deletes all references to a specific command from the database.
func FindCommand ¶
func FindCommand(ctx context.Context, exec boil.Executor, id int64, name string, forUpdate bool) (info *models.CommandInfo, commandMsg null.String, found bool, err error)
FindCommand finds a command for a given channel.
func ListActiveChannels ¶
ListActiveChannels returns a list of active IRC channels (with # prefix) for the specified bot.
func ModelToToken ¶
func ModelToToken(tt *models.TwitchToken) *oauth2.Token
ModelToToken converts a token model to an oauth2 token for use in an HTTP client.
func NewChannel ¶
NewChannel creates a new Channel with the defaults set.
func TokenToModel ¶
func TokenToModel(tok *oauth2.Token, id int64, botName null.String, scopes []string) *models.TwitchToken
TokenToModel converts a Twitch user's oauth2 token to a model for insertion.
func TokenToModelWithoutPreservedColumns ¶
func TokenToModelWithoutPreservedColumns(tok *oauth2.Token, id int64) *models.TwitchToken
TokenToModelWithoutPreservedColumns converts a Twitch user's oauth2 token to a model for insertion, without BotName and Scopes.
func UpsertToken ¶
func UpsertToken(ctx context.Context, exec boil.ContextExecutor, tt *models.TwitchToken) error
UpsertToken inserts the token into the database, or inserts all columns as written in the model.
func UpsertTokenWithoutPreservedColumns ¶
func UpsertTokenWithoutPreservedColumns(ctx context.Context, exec boil.ContextExecutor, tt *models.TwitchToken) error
UpsertTokenWithoutPreservedColumns upserts a token without BotName and Scopes.
Types ¶
This section is empty.