caffeine_query_language/resolver

Types

pub type Comparator {
  LessThan
  LessThanOrEqualTo
  GreaterThan
  GreaterThanOrEqualTo
}

Constructors

  • LessThan
  • LessThanOrEqualTo
  • GreaterThan
  • GreaterThanOrEqualTo

Supported primitive query types that can be resolved from CQL expressions. Each primitive represents a specific SLO calculation pattern.

pub type Primitives {
  GoodOverTotal(numerator: parser.Exp, denominator: parser.Exp)
  TimeSlice(
    comparator: Comparator,
    interval_in_seconds: Int,
    threshold: Float,
    query: String,
  )
}

Constructors

  • GoodOverTotal(numerator: parser.Exp, denominator: parser.Exp)

    Good over total requires a top level division operator. Represents an SLO where the numerator is the “good” events and the denominator is the “total” events.

  • TimeSlice(
      comparator: Comparator,
      interval_in_seconds: Int,
      threshold: Float,
      query: String,
    )

Values

pub fn comparator_to_string(comparator: Comparator) -> String
pub fn resolve_primitives(
  exp_container: parser.ExpContainer,
) -> Result(Primitives, errors.CompilationError)

Resolves a parsed CQL expression into a primitive type. Supports GoodOverTotal (division at the top level) and TimeSlice. Returns an error if the expression doesn’t match a known primitive pattern.

Search Document