View Source Loupe.Stream.Comparator behaviour (Loupe v0.11.0)

Behaviour to implement comparator. It could be useful to implement your own comparator to alter how fields are getting compared.

Overriding the comparator can allow someone to implement variant casting (exmaple field:upper to uppercase values automatically), alter the comparison logic or implement sigil casting.

Link to this section Summary

Callbacks

Applies a field variant on a value. This can be used to have expression like value:upper be automatically uppercased.

Casts a sigil to kind of value to be compared.

Compares a stream's value with a literal value

Functions

Compares predicates inside a given map/structure tree

Link to this section Callbacks

@callback apply_variant(any(), String.t()) :: any()

Applies a field variant on a value. This can be used to have expression like value:upper be automatically uppercased.

@callback cast_sigil(char(), String.t()) :: any()

Casts a sigil to kind of value to be compared.

@callback compare(Loupe.Language.Ast.operator()) :: boolean()

Compares a stream's value with a literal value

Link to this section Functions

Link to this function

compare(operand, element, context)

View Source

Compares predicates inside a given map/structure tree