feat(plugins): major improvement in plugins golang code

This commit is contained in:
Torkel Ödegaard
2016-01-09 23:34:20 +01:00
parent 35f40b7312
commit 1ffcea1952
20 changed files with 218 additions and 182 deletions

View File

@ -0,0 +1,25 @@
package plugins
import "encoding/json"
type DataSourcePlugin struct {
FrontendPluginBase
DefaultMatchFormat string `json:"defaultMatchFormat"`
Annotations bool `json:"annotations"`
Metrics bool `json:"metrics"`
BuiltIn bool `json:"builtIn"`
Mixed bool `json:"mixed"`
App string `json:"app"`
}
func (p *DataSourcePlugin) Load(decoder *json.Decoder, pluginDir string) error {
if err := decoder.Decode(&p); err != nil {
return err
}
p.PluginDir = pluginDir
p.initFrontendPlugin()
DataSources[p.Id] = p
return nil
}