Documentation
¶
Index ¶
- Variables
- type Channel
- type ChannelByName
- type ChannelCreator
- type ChannelExistsChecker
- type ChannelID
- type ChannelIDFinder
- type ChannelIDProvider
- func NewChannelIDProvider(channelIDFinder ChannelIDFinder, channelCreator ChannelCreator) ChannelIDProvider
- func NewChannelIDProviderCache(channelIDProvider ChannelIDProvider) ChannelIDProvider
- func NewChannelIDProviderStore(channelStore ChannelStore, channelIDProvider ChannelIDProvider, ...) ChannelIDProvider
- type ChannelIDProviderFunc
- type ChannelIDProviderTx
- type ChannelIDProviderTxFunc
- type ChannelIDs
- type ChannelStore
- type ChannelStoreTx
- type ChannelStreamer
- type Channels
- type MessageSender
- type MessageSenderFunc
- type ServerID
Constants ¶
This section is empty.
Variables ¶
View Source
var ChannelNotFoundError = stderrors.New("channel not found")
View Source
var MultipleChannelFoundError = stderrors.New("found multiple channels")
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct {
ID ChannelID
Name discord.ChannelName
}
type ChannelByName ¶
type ChannelByName Channels
func (ChannelByName) Len ¶
func (p ChannelByName) Len() int
func (ChannelByName) Less ¶
func (p ChannelByName) Less(i, j int) bool
func (ChannelByName) Swap ¶
func (p ChannelByName) Swap(i, j int)
type ChannelCreator ¶
type ChannelCreator interface {
CreateChannel(ctx context.Context, name discord.ChannelName) (*Channel, error)
}
func NewChannelCreator ¶
func NewChannelCreator( session *discordgo.Session, serverID ServerID, ) ChannelCreator
type ChannelExistsChecker ¶
type ChannelExistsChecker interface {
Exists(ctx context.Context, channelID ChannelID) (bool, error)
}
func NewChannelExistsChecker ¶
func NewChannelExistsChecker(discordSession *discordgo.Session) ChannelExistsChecker
type ChannelIDFinder ¶
type ChannelIDFinder interface {
FindByName(ctx context.Context, name discord.ChannelName) (Channels, error)
}
func NewChannelIDFinder ¶
func NewChannelIDFinder( channelStreamer ChannelStreamer, ) ChannelIDFinder
type ChannelIDProvider ¶
type ChannelIDProvider interface {
FindOrCreate(ctx context.Context, name discord.ChannelName) (*ChannelID, error)
}
func NewChannelIDProvider ¶
func NewChannelIDProvider( channelIDFinder ChannelIDFinder, channelCreator ChannelCreator, ) ChannelIDProvider
func NewChannelIDProviderCache ¶
func NewChannelIDProviderCache( channelIDProvider ChannelIDProvider, ) ChannelIDProvider
func NewChannelIDProviderStore ¶
func NewChannelIDProviderStore( channelStore ChannelStore, channelIDProvider ChannelIDProvider, channelExistsChecker ChannelExistsChecker, ) ChannelIDProvider
type ChannelIDProviderFunc ¶
func (ChannelIDProviderFunc) FindOrCreate ¶
func (c ChannelIDProviderFunc) FindOrCreate( ctx context.Context, name discord.ChannelName, ) (*ChannelID, error)
type ChannelIDProviderTx ¶
type ChannelIDProviderTx interface {
FindOrCreate(ctx context.Context, tx libkv.Tx, name discord.ChannelName) (*ChannelID, error)
}
ChannelIDProviderTx is a transaction-aware version of ChannelIDProvider that accepts an existing transaction instead of opening a new one.
func NewChannelIDProviderStoreTx ¶
func NewChannelIDProviderStoreTx( channelStoreTx ChannelStoreTx, channelIDProvider ChannelIDProvider, channelExistsChecker ChannelExistsChecker, ) ChannelIDProviderTx
NewChannelIDProviderStoreTx creates a transaction-aware channel ID provider that uses the existing transaction instead of opening a new one.
type ChannelIDProviderTxFunc ¶
type ChannelIDProviderTxFunc func(ctx context.Context, tx libkv.Tx, name discord.ChannelName) (*ChannelID, error)
ChannelIDProviderTxFunc is a function adapter for ChannelIDProviderTx
func (ChannelIDProviderTxFunc) FindOrCreate ¶
func (c ChannelIDProviderTxFunc) FindOrCreate( ctx context.Context, tx libkv.Tx, name discord.ChannelName, ) (*ChannelID, error)
type ChannelIDs ¶
type ChannelIDs []ChannelID
func (ChannelIDs) Contains ¶
func (c ChannelIDs) Contains(channelID ChannelID) bool
type ChannelStore ¶
type ChannelStore interface {
Add(ctx context.Context, name discord.ChannelName, channelID ChannelID) error
Get(ctx context.Context, name discord.ChannelName) (*ChannelID, error)
Stream(ctx context.Context, ch chan<- Channel) error
Purge(ctx context.Context) error
Delete(ctx context.Context, name discord.ChannelName) error
}
func NewChannelStore ¶
func NewChannelStore(db libkv.DB) ChannelStore
type ChannelStoreTx ¶
type ChannelStoreTx interface {
Add(ctx context.Context, tx libkv.Tx, name discord.ChannelName, channelID ChannelID) error
Get(ctx context.Context, tx libkv.Tx, name discord.ChannelName) (*ChannelID, error)
Stream(ctx context.Context, tx libkv.Tx, ch chan<- Channel) error
Purge(ctx context.Context, tx libkv.Tx) error
Delete(ctx context.Context, tx libkv.Tx, name discord.ChannelName) error
}
func NewChannelStoreTx ¶
func NewChannelStoreTx() ChannelStoreTx
type ChannelStreamer ¶
func NewChannelStreamer ¶
func NewChannelStreamer( session *discordgo.Session, serverID ServerID, ) ChannelStreamer
type MessageSender ¶
type MessageSender interface {
Send(ctx context.Context, channelID ChannelID, message discord.Message) error
}
func NewMessageSender ¶
func NewMessageSender(session *discordgo.Session) MessageSender
Source Files
¶
Click to show internal directories.
Click to hide internal directories.