The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/pkg/plugins/fakes.go

38 lines
631 B

package plugins
import (
"context"
)
type FakePluginStore struct {
Store
PluginList []PluginDTO
}
func (pr FakePluginStore) Plugin(_ context.Context, pluginID string) (PluginDTO, bool) {
for _, v := range pr.PluginList {
if v.ID == pluginID {
return v, true
}
}
return PluginDTO{}, false
}
func (pr FakePluginStore) Plugins(_ context.Context, pluginTypes ...Type) []PluginDTO {
var result []PluginDTO
if len(pluginTypes) == 0 {
pluginTypes = PluginTypes
}
for _, v := range pr.PluginList {
for _, t := range pluginTypes {
if v.Type == t {
result = append(result, v)
}
}
}
return result
}