function

Compare

Construct a comparison while returning validation errors.

Arguments

ArgumentTypeDescription
pathPathThe path value.
operatorOperatorThe operator value.
valueValueThe value value.

Returns

The declared result.

(Expression, error)

How it works

Use it when the operator or value comes from input. The comparison helpers such as Equal panic on a malformed name or incompatible value instead.

Full signature

func Compare( path Path, operator Operator, value Value, ) (Expression, error)

Source query/expression.go:70

Related types

  • Path

    An immutable, validated document field path.

  • Operator

    The finite comparison vocabulary.

  • Value

    An immutable scalar or list comparison operand.

  • Expression

    A sealed immutable predicate consumed atomically by stores.