datasource_plugin.go 597 B

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