Documentation
¶
Index ¶
Constants ¶
View Source
const ( PubKeyEventSub Key = "EventSub" Prefix = "Melonbot:" Nil = redis.Nil )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Instance ¶
type Instance interface {
// Ping checks if the redis instance is alive
Ping(context.Context) error
// Get returns the value of the key
Get(context.Context, Key) (string, error)
// Set sets the value of the key
//
// No expiration is set
Set(context.Context, Key, string) error
// Del deletes the key
Del(context.Context, Key) error
// Expire sets the expiration of the key
Expire(context.Context, Key, time.Duration) error
// Subscribe subscribes to a channel and returns a channel
Subscribe(context.Context, Key) chan PubMessage
// Publish publish a struct to a channel
//
// Data is sent as {
// "Type": Key
// "Data": interface{}
// }
//
// This allows the receiver to know what type of data it is receiving
//
// Such as Eventsub, where the type could be "foo" or "bar"
//
// And the data would could be different for each type
Publish(context.Context, Key, PubJSON) error
// Prefix returns the prefix used for all keys
Prefix() string
}
type PubMessage ¶
Click to show internal directories.
Click to hide internal directories.