mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
Add a note in example to prefer eval_rule over eval_query (#204)
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
05e91da06e
commit
82c86437cb
@@ -70,7 +70,14 @@ fn rego_eval(
|
||||
engine.set_input(input);
|
||||
}
|
||||
|
||||
// Evaluate query.
|
||||
// Note: The `eval_query` function is used below since it produces output
|
||||
// in the same format as OPA. It also allows evaluating arbitrary statements
|
||||
// as queries.
|
||||
//
|
||||
// Most applications will want to use `eval_rule` instead.
|
||||
// It is faster since it does not have to parse the query string.
|
||||
// It also returns the value of the rule directly and thus is easier
|
||||
// to use.
|
||||
let results = engine.eval_query(query, enable_tracing)?;
|
||||
|
||||
println!("{}", serde_json::to_string_pretty(&results)?);
|
||||
|
||||
Reference in New Issue
Block a user