You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is no other New* function, so why not just New()?
Personally, I'd rename the types from EvaluableExpression, ExpressionFunction etc. to Expression, Function etc.
And change the import name to eval. eval.New("...") seems much more Go-like:
expression, err:=govaluate.NewEvaluableExpression("(requests_made * requests_succeeded / 100) >= 90");
parameters:=make(map[string]interface{}, 8)
parameters["requests_made"] =100;
parameters["requests_succeeded"] =80;
result, err:=expression.Evaluate(parameters);
// result is now set to "false", the bool value.
vs
exp, err:=eval.New("(requests_made * requests_succeeded / 100) >= 90");
params:=make(map[string]interface{}, 8)
params["requests_made"] =100;
params["requests_succeeded"] =80;
r, err:=exp.Evaluate(params);
// r is now set to "false", the bool value.
seems very un-go-like: e.g., NewEvaluableExpression -> NewExpr would be a lot easier to type etc.
anyway, just a comment in case there is a new version released at some point :)
The text was updated successfully, but these errors were encountered: