cozodb / cozo

A transactional, relational-graph-vector database that uses Datalog for query. The hippocampus for AI!
https://cozodb.org
Mozilla Public License 2.0
3.44k stars 108 forks source link

Make Expr::eval_to_const public for FixedRule. #162

Open thipokch opened 1 year ago

thipokch commented 1 year ago

Context

I'm writing a custom fixed rules with parameters/options. I am able to get scalar value (bool, int, string...) from options just fine.

Problem

With Lists, I can extract the values using expr_option(), which returns Expr. However, I am unable to use value from Expr, because it has yet to be evaluated Const variant using eval_to_const().

Solution

  1. Make Expr::eval_to_const public
  2. Evaluate expression to const for FixedRule.
thipokch commented 1 year ago

@zh217 Thank you :)