Documentation ¶
Index ¶
- Variables
- type Database
- type Manager
- func (m *Manager) HasInstance(pluginID uint) bool
- func (m *Manager) InitializeForUserID(userID uint) error
- func (m *Manager) Instance(pluginID uint) (compat.PluginInstance, error)
- func (m *Manager) LoadPlugin(compatPlugin compat.Plugin) error
- func (m *Manager) PluginInfo(modulePath string) compat.Info
- func (m *Manager) RemoveUser(userID uint) error
- func (m *Manager) SetPluginEnabled(pluginID uint, enabled bool) error
- type MessageWithUserID
- type Notifier
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyEnabledOrDisabled = errors.New("config is already enabled/disabled")
ErrAlreadyEnabledOrDisabled is returned on SetPluginEnabled call when a plugin is already enabled or disabled.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { GetUsers() ([]*model.User, error) GetPluginConfByUserAndPath(userid uint, path string) (*model.PluginConf, error) CreatePluginConf(p *model.PluginConf) error GetPluginConfByApplicationID(appid uint) (*model.PluginConf, error) UpdatePluginConf(p *model.PluginConf) error CreateMessage(message *model.Message) error GetPluginConfByID(id uint) (*model.PluginConf, error) GetPluginConfByToken(token string) (*model.PluginConf, error) GetUserByID(id uint) (*model.User, error) CreateApplication(application *model.Application) error UpdateApplication(app *model.Application) error GetApplicationsByUser(userID uint) ([]*model.Application, error) GetApplicationByToken(token string) (*model.Application, error) }
The Database interface for encapsulating database access.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is an encapsulating layer for plugins and manages all plugins and its instances.
func NewManager ¶
func NewManager(db Database, directory string, mux *gin.RouterGroup, notifier Notifier) (*Manager, error)
NewManager created a Manager from configurations.
func (*Manager) HasInstance ¶
HasInstance returns whether the given plugin ID has a corresponding instance.
func (*Manager) InitializeForUserID ¶
InitializeForUserID initializes all plugin instances for a given user.
func (*Manager) Instance ¶
func (m *Manager) Instance(pluginID uint) (compat.PluginInstance, error)
Instance returns an instance with the given ID.
func (*Manager) LoadPlugin ¶
LoadPlugin loads a compat plugin, exported to sideload plugins for testing purposes.
func (*Manager) PluginInfo ¶
PluginInfo returns plugin info.
func (*Manager) RemoveUser ¶
RemoveUser disabled all plugins of a user when the user is disabled.
type MessageWithUserID ¶
type MessageWithUserID struct { Message model.MessageExternal UserID uint }
MessageWithUserID encapsulates a message with a given user ID.
type Notifier ¶
type Notifier interface {
Notify(userID uint, message *model.MessageExternal)
}
Notifier notifies when a new message was created.