Skip to content

Expression🔗

Definition🔗

type Expression struct {
    // The type of query if this is a query expression
    QueryType *string `json:"queryType,omitempty"`
    RelativeTimeRange *alertingv0alpha1.RelativeTimeRange `json:"relativeTimeRange,omitempty"`
    // The UID of the datasource to run this expression against. If omitted, the expression will be run against the `__expr__` datasource
    DatasourceUID *alertingv0alpha1.DatasourceUID `json:"datasourceUID,omitempty"`
    Model any `json:"model"`
    // Used to mark the expression to be used as the final source for the rule evaluation
    // Only one expression in a rule can be marked as the source
    // For AlertRules, this is the expression that will be evaluated against the alerting condition
    // For RecordingRules, this is the expression that will be recorded
    Source *bool `json:"source,omitempty"`
}

Methods🔗

UnmarshalJSONStrict🔗

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode Expression from JSON.

Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (expression *Expression) UnmarshalJSONStrict(raw []byte) error

Equals🔗

Equals tests the equality of two Expression objects.

func (expression *Expression) Equals(other Expression) bool

Validate🔗

Validate checks all the validation constraints that may be defined on Expression fields for violations and returns them.

func (expression *Expression) Validate() error

See also🔗