if
Conditional control flow function. Only one of 'then' or 'else' is executed.
Example:
Query:
e.if({- condition: e.equal(d.string("foo"), d.string("bar")),
- then: d.string("foo and bar are equal"),
- else: d.string("foo and bar are not equal"),
})
Result:
"foo and bar are not equal"
not
not logically negates its boolean argument.
Example:
Query:
e.not(d.bool(true))
assertModelRef
Takes a model ref and asserts its case to be a "case".
Example:
Query:
e.assertModelRef({- ref: e.tag(d.string("_tag")),
- value: e.first(e.all(e.tag(d.string("_tag")))),
})
Result:
{
"model": [
"RumQCGlURNcXIqvD",
"qWbVomsJmZDcxXUf"
],
"tag": "_role"
}
or
or takes a list of boolean expressions and returns logical or.
Example:
Query:
e.or(d.bool(true), d.bool(false))
Result:
true
switchCase
Takes a union and switches on its case. Returns the result of calling the matching case expression in "cases" with the unwrapped union value.
Example:
Query:
e.switchCase(e.data(d.union("foo", d.string("bar"))), e.foo(f.function(["_value_0"], {- scope: "_value_0",
})))
Result:
"bar"
with
Passes the result of an expression as the first parameter of the given function.
Example:
Query:
e.with(d.string("foo"), f.function(["_value_0"], {- scope: "_value_0",
}))
Result:
"foo"
assertCase
Takes a union and asserts its case to be a "case". It returns the unwrapped union value or an error if the assertion fails.
Example:
Query:
e.assertCase({- case: "foo",
- value: e.data(d.union("foo", d.string("bar"))),
})
Result:
"bar"
equal
equal takes a tuple of two values of any type and reports whether they are the same.
Example:
Query:
e.equal(d.string("foo"), d.string("bar"))
assertPresent
Takes an arbitrary value that could be null and asserts that it is not null. Returns an error if the assertion fails.
- T
- null
→ T
Example:
Query:
e.assertPresent(d.string("foo"))
Result:
"foo"
switchModelRef
Takes a persistent value and switches on its model ref. Returns the result of calling the matching case expression or default if none matched.