mirror of
https://github.com/grafana/loki.git
synced 2026-03-13 09:33:58 +08:00
28 lines
671 B
Go
28 lines
671 B
Go
package expr
|
|
|
|
// UnaryOp denotes a unary operation to perform against a single argument.
|
|
type UnaryOp int
|
|
|
|
const (
|
|
// UnaryOpInvalid indicates an invalid unary operation. Evaluating a
|
|
// UnaryOpInvalid will result in an error.
|
|
UnaryOpInvalid UnaryOp = iota
|
|
|
|
// UnaryOpNOT represents a logical NOT operation over a boolean value.
|
|
UnaryOpNOT
|
|
)
|
|
|
|
var unaryOpStrings = [...]string{
|
|
UnaryOpInvalid: "INVALID",
|
|
UnaryOpNOT: "NOT",
|
|
}
|
|
|
|
// String returns the string representation of op. If op is out of bounds, it
|
|
// returns "INVALID."
|
|
func (op UnaryOp) String() string {
|
|
if op < 0 || int(op) >= len(unaryOpStrings) {
|
|
return "INVALID"
|
|
}
|
|
return unaryOpStrings[op]
|
|
}
|