Documentation ¶
Index ¶
- Variables
- type Queue
- type RedisQueue
- func (q *RedisQueue) Add(guildID uint64, tracks []string) error
- func (q *RedisQueue) List(guildID uint64, index int, count uint) (tracks []string, err error)
- func (q *RedisQueue) Move(guildID uint64, from, to int) error
- func (q *RedisQueue) Next(guildID uint64, count int) (skipped []string, err error)
- func (q *RedisQueue) NowPlaying(guildID uint64) (np string, err error)
- func (q *RedisQueue) Put(guildID uint64, tracks map[int]string) error
- func (q *RedisQueue) Remove(guildID uint64, index int) error
- func (q *RedisQueue) Set(guildID uint64, tracks []string) error
- func (q *RedisQueue) Shuffle(guildID uint64) (list []string, err error)
- func (q *RedisQueue) Splice(guildID uint64, start, deleteCount int, tracks ...string) (list []string, err error)
- func (q *RedisQueue) Trim(guildID uint64, start, end int) error
- func (q *RedisQueue) Unshift(guildID uint64, tracks ...string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // LPut puts elements into the list at the specified index // Keys: // - list to put the elements into // Values: // - ...json.Marshalled map[int]string where K is position and V is the value to insert LPut = redis.NewScript(_escFSMustString(false, "/redis_scripts/lput.lua")) // LOverride resets the elements in a list // Keys: // - list to override // Values: // - ...values to insert LOverride = redis.NewScript(_escFSMustString(false, "/redis_scripts/loverride.lua")) // LMove moves an element in a list // Keys: // - the list to move the elements in // Values: // - (int) from index // - (int) to index LMove = redis.NewScript(_escFSMustString(false, "/redis_scripts/lmove.lua")) // LShuffle shuffles a list // Keys: // - the list to shuffle // Values: // - randomization seed LShuffle = redis.NewScript(_escFSMustString(false, "/redis_scripts/lshuffle.lua")) // LRevSplice splices a list in reverse // Keys: // - the list to splice // Values: // - (int) start: the index to start splicing at // - (int) deleteCount: the number of elements to remove // - ...elements to insert LRevSplice = redis.NewScript(_escFSMustString(false, "/redis_scripts/lrevsplice.lua")) // MultiRPopLPush moves multiple elements from the right of one list to the left of another // Keys: // - RPop list // - LPush list // Values: // - (int) count: number of elements to move MultiRPopLPush = redis.NewScript(_escFSMustString(false, "/redis_scripts/multirpoplpush.lua")) )
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue interface { Add(guildID uint64, tracks []string) error Set(guildID uint64, tracks []string) error Put(guildID uint64, tracks map[int]string) error Unshift(guildID uint64, tracks ...string) error Remove(guildID uint64, index int) error Next(guildID uint64, count int) ([]string, error) Move(guildID uint64, from, to int) error Shuffle(guildID uint64) ([]string, error) Splice(guildID uint64, start, deleteCount int, tracks ...string) ([]string, error) Trim(guildID uint64, start, end int) error NowPlaying(guildID uint64) (string, error) List(guildID uint64, index int, count uint) ([]string, error) }
Queue represents a store of songs
type RedisQueue ¶
type RedisQueue struct {
// contains filtered or unexported fields
}
RedisQueue represents a song queue in redis
func (*RedisQueue) Add ¶
func (q *RedisQueue) Add(guildID uint64, tracks []string) error
Add adds songs to the end queue
func (*RedisQueue) Move ¶
func (q *RedisQueue) Move(guildID uint64, from, to int) error
Move moves songs in the list by index
func (*RedisQueue) Next ¶
func (q *RedisQueue) Next(guildID uint64, count int) (skipped []string, err error)
Next advances the playlist
func (*RedisQueue) NowPlaying ¶
func (q *RedisQueue) NowPlaying(guildID uint64) (np string, err error)
NowPlaying gets the currently playing track
func (*RedisQueue) Put ¶
func (q *RedisQueue) Put(guildID uint64, tracks map[int]string) error
Put puts the specified elements into the queue at the specified positions
func (*RedisQueue) Remove ¶
func (q *RedisQueue) Remove(guildID uint64, index int) error
Remove removes a song from the queue at the index
func (*RedisQueue) Set ¶
func (q *RedisQueue) Set(guildID uint64, tracks []string) error
Set overwrites songs in the queue
func (*RedisQueue) Shuffle ¶
func (q *RedisQueue) Shuffle(guildID uint64) (list []string, err error)
Shuffle shuffles the queue
func (*RedisQueue) Splice ¶
func (q *RedisQueue) Splice(guildID uint64, start, deleteCount int, tracks ...string) (list []string, err error)
Splice splices the queue
Click to show internal directories.
Click to hide internal directories.