tools

package
v0.9.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2026 License: BSD-3-Clause-LBNL Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VersionKey = "Version"
)

Variables

This section is empty.

Functions

func CreateDestinationPath

func CreateDestinationPath(folderName string, clearOutput bool, v string)

CreateDestinationPath Handle osMkdir Errors

func DeepCopy

func DeepCopy[T any](value T) (*T, error)

DeepCopy creates a deep copy of the given value using JSON serialization, returning a pointer and an error.

func GetUserConfirmation

func GetUserConfirmation(msg, error string, terminate bool) bool

GetUserConfirmation prompts user to confirm operation msg Message to prompt the user with validate returns true/false on success or terminates the process msg: prompt to display to the user asking for a response. error: error message to display if app should terminate terminate: when set to true will terminate the app user response is not valid.

func InRange

func InRange(ranges []VersionRange, api GetVersion) bool

InRange returns true if the current Grafana version falls within all of the supplied ranges (inclusive on both ends). Returns false if any range is invalid or the version lies outside any range.

func ReverseLookUp

func ReverseLookUp[T comparable, Y comparable](m map[T]Y) map[Y]T

ReverseLookUp Creates a reverse look-up map, where the values are the keys and the keys are the values.

func ValidateMinimumVersion

func ValidateMinimumVersion(minVersion string, api GetVersion) bool

ValidateMinimumVersion returns true if the current Grafana server version is greater than or equal to minVersion. minVersion may be prefixed with "v" or given as a bare semver string (e.g. "13.0.0" or "v13.0.0").

Types

type GetVersion

type GetVersion interface {
	GetServerInfo() map[string]any
}

GetVersion is implemented by any service that can report the Grafana server info.

type VersionRange

type VersionRange struct {
	MinVersion string
	MaxVersion string
}

func (VersionRange) Validate

func (v VersionRange) Validate() bool

Validate ensures the version strings in the range are parseable by semver.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL