func Default(value string) Option {
	return func(interval *Interval) {
		interval.Builder.Current = sdk.Current{
			Text:  &sdk.StringSliceString{Value: []string{value}, Valid: true},
			Value: value,
		}
	}
}
Default sets the default value of the variable.
package interval
import (
	"sort"
	"strings"
	"github.com/grafana-tools/sdk"
	"github.com/prometheus/common/model"
)
type Option func(interval *Interval)
type ValuesList []string
type Interval struct {
	Builder sdk.TemplateVar
}
func New(name string, options ...Option) *Interval {
	interval := &Interval{Builder: sdk.TemplateVar{
		Name:  name,
		Label: name,
		Type:  "interval",
	}}
	for _, opt := range options {
		opt(interval)
	}
	return interval
}
func Values(values ValuesList) Option {
	return func(interval *Interval) {
		sort.SliceStable(values, func(i, j int) bool {
			iDuration, _ := model.ParseDuration(values[i])
			jDuration, _ := model.ParseDuration(values[j])
			return iDuration < jDuration
		})
		for _, value := range values {
			interval.Builder.Options = append(interval.Builder.Options, sdk.Option{
				Text:  value,
				Value: value,
			})
		}
		interval.Builder.Query = strings.Join(values, ",")
	}
}