strutil

package
v0.0.0-...-2e5e298 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: BSD-3-Clause, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSyntax = errors.New("invalid syntax")

ErrSyntax indicates that a value does not have the right syntax for the target type.

Functions

func GraphLinkForExpression

func GraphLinkForExpression(expr string) string

GraphLinkForExpression creates an escaped relative link to the graph view of the provided expression.

func SanitizeLabelName

func SanitizeLabelName(name string) string

SanitizeLabelName replaces anything that doesn't match client_label.LabelNameRE with an underscore.

func TableLinkForExpression

func TableLinkForExpression(expr string) string

TableLinkForExpression creates an escaped relative link to the table view of the provided expression.

func Unquote

func Unquote(s string) (t string, err error)

Unquote interprets s as a single-quoted, double-quoted, or backquoted Prometheus query language string literal, returning the string value that s quotes.

NOTE: This function as well as the necessary helper functions below (unquoteChar, contains, unhex) and associated tests have been adapted from the corresponding functions in the "strconv" package of the Go standard library to work for Prometheus-style strings. Go's special-casing for single quotes was removed and single quoted strings are now treated the same as double quoted ones.

Types

This section is empty.

Jump to

Keyboard shortcuts

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