datasource_plugin.go 573 B

123456789101112131415161718192021222324
  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. DataSources[p.Id] = p
  18. return nil
  19. }