Documentation
¶
Index ¶
- Variables
- func IntervalString(s string, defaultSign int) (int32, error)
- func IsNameChar(r byte) bool
- func TruthyBool(s string) bool
- type ArgName
- type ArgValue
- type Expr
- func NewConstExpr(value float64) Expr
- func NewExpr(target string, vaArgs ...interface{}) Expr
- func NewExprTyped(target string, args []Expr) Expr
- func NewNameExpr(name string) Expr
- func NewTargetExpr(target string) Expr
- func NewValueExpr(value string) Expr
- func Parse(e string) (Expr, string, error)
- func ParseExpr(e string) (Expr, string, error)
- type ExprType
- type MetricRequest
- type NamedArgs
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMissingExpr is a parse error returned when an expression is missing. ErrMissingExpr = errors.New("missing expression") // ErrMissingComma is a parse error returned when an expression is missing a comma. ErrMissingComma = errors.New("missing comma") // ErrMissingQuote is a parse error returned when an expression is missing a quote. ErrMissingQuote = errors.New("missing quote") // ErrUnexpectedCharacter is a parse error returned when an expression contains an unexpected character. ErrUnexpectedCharacter = errors.New("unexpected character") // ErrBadType is an eval error returned when a argument has wrong type. ErrBadType = errors.New("bad type") // ErrMissingArgument is an eval error returned when a argument is missing. ErrMissingArgument = errors.New("missing argument") // ErrMissingTimeseries is an eval error returned when a time series argument is missing. ErrMissingTimeseries = errors.New("missing time series argument") // ErrSeriesDoesNotExist is an eval error returned when a requested time series argument does not exist. ErrSeriesDoesNotExist = errors.New("no timeseries with that name") // ErrUnknownTimeUnits is an eval error returned when a time unit is unknown to system ErrUnknownTimeUnits = errors.New("unknown time units") )
var RangeTables []*unicode.RangeTable
RangeTables is an array of *unicode.RangeTable
Functions ¶
func IntervalString ¶
IntervalString converts a sign and string into a number of seconds
func IsNameChar ¶
IsNameChar checks if specified char is actually a valid (from graphite's protocol point of view)
func TruthyBool ¶
Types ¶
type Expr ¶
type Expr interface {
// IsName checks if Expression is 'Series Name' expression
IsName() bool
// IsFunc checks if Expression is 'Function' expression
IsFunc() bool
// IsConst checks if Expression is 'Constant' expression
IsConst() bool
// IsString checks if Expression is 'String' expression
IsString() bool
// Type returns type of the expression
Type() ExprType
// Target returns target value for expression
Target() string
// SetTarget changes target for the expression
SetTarget(string)
// MutateTarget changes target for the expression and returns new interface. Please note that it doesn't copy object yet
MutateTarget(string) Expr
// ToString returns string representation of expression
ToString() string
// FloatValue returns float value for expression.
FloatValue() float64
// StringValue returns value of String-typed expression (will return empty string for ConstExpr for example).
StringValue() string
// SetValString changes value of String-typed expression
SetValString(string)
// MutateValString changes ValString for the expression and returns new interface. Please note that it doesn't copy object yet
MutateValString(string) Expr
// Args returns slice of arguments (parsed, as Expr interface as well)
Args() []Expr
// NamedArgs returns map of named arguments. E.x. for nonNegativeDerivative(metric1,maxValue=32) it will return map{"maxValue": constExpr(32)}
NamedArgs() map[string]Expr
// RawArgs returns string that contains all arguments of expression exactly the same order they appear
RawArgs() string
// SetRawArgs changes raw argument list for current expression.
SetRawArgs(args string)
// MutateRawArgs changes raw argument list for the expression and returns new interface. Please note that it doesn't copy object yet
MutateRawArgs(args string) Expr
// Metrics returns list of metric requests
Metrics() []MetricRequest
// GetIntervalArg returns interval typed argument.
GetIntervalArg(n int, defaultSign int) (int32, error)
// GetIntervalArg returns n-th argument as string.
GetStringArg(n int) (string, error)
// GetIntervalArg returns n-th argument as string. It will replace it with Default value if none present.
GetStringArgDefault(n int, s string) (string, error)
// GetStringNamedOrPosArgDefault returns specific positioned string-typed argument or replace it with default if none found.
GetStringNamedOrPosArgDefault(k string, n int, s string) (string, error)
// GetFloatArg returns n-th argument as float-typed (if it's convertible to float)
GetFloatArg(n int) (float64, error)
// GetFloatArgDefault returns n-th argument as float. It will replace it with Default value if none present.
GetFloatArgDefault(n int, v float64) (float64, error)
// GetFloatNamedOrPosArgDefault returns specific positioned float64-typed argument or replace it with default if none found.
GetFloatNamedOrPosArgDefault(k string, n int, v float64) (float64, error)
// GetIntArg returns n-th argument as int-typed
GetIntArg(n int) (int, error)
// GetIntArgs returns n-th argument as slice of ints
GetIntArgs(n int) ([]int, error)
// GetIntArgDefault returns n-th argument as int. It will replace it with Default value if none present.
GetIntArgDefault(n int, d int) (int, error)
// GetIntNamedOrPosArgDefault returns specific positioned int-typed argument or replace it with default if none found.
GetIntNamedOrPosArgDefault(k string, n int, d int) (int, error)
GetNamedArg(name string) Expr
// GetBoolArgDefault returns n-th argument as bool. It will replace it with Default value if none present.
GetBoolArgDefault(n int, b bool) (bool, error)
// GetBoolNamedOrPosArgDefault returns specific positioned bool-typed argument or replace it with default if none found.
GetBoolNamedOrPosArgDefault(k string, n int, b bool) (bool, error)
// contains filtered or unexported methods
}
Expr defines an interface to talk with expressions
func NewConstExpr ¶
NewConstExpr Creates new Constant expression.
func NewExpr ¶
NewExpr creates a new expression with specified target and arguments. It will do best it can to identify type of argument
func NewExprTyped ¶
NewExprTyped creates a new expression with specified target and arguments. Strictly typed one.
func NewNameExpr ¶
NewNameExpr Creates new expression with specified name only.
func NewTargetExpr ¶
NewTargetExpr Creates new expression with specified target only.
type ExprType ¶
type ExprType int
ExprType defines a type for expression types constants (e.x. functions, values, constants, parameters, strings)
type MetricRequest ¶
MetricRequest contains all necessary data to request a metric.