datasource_plugin.go 527 B

12345678910111213141516171819202122232425
  1. package plugins
  2. import "encoding/json"
  3. type DataSourcePlugin struct {
  4. FrontendPluginBase
  5. Annotations bool `json:"annotations"`
  6. Metrics bool `json:"metrics"`
  7. BuiltIn bool `json:"builtIn"`
  8. Mixed bool `json:"mixed"`
  9. App string `json:"app"`
  10. }
  11. func (p *DataSourcePlugin) Load(decoder *json.Decoder, pluginDir string) error {
  12. if err := decoder.Decode(&p); err != nil {
  13. return err
  14. }
  15. if err := p.registerPlugin(pluginDir); err != nil {
  16. return err
  17. }
  18. DataSources[p.Id] = p
  19. return nil
  20. }