I am trying to implement a functionality that lets users try out configurations in run rime.
Basically, there are some preexisting configurations in DB, but users can make some tweaks on top of those and see results.
This component is written in Golang. One approach i am thinking is about using expression language support. I found some open source packages like https://github.com/araddon/qlbridge
But there are almost negligible number of sample programs / tutorials that demo how to use expression language along with PostgresQL.
Has any one used and attempted such thing? Any suggestions are welcome. Thank you for your time!
Try https://github.com/antonmedv/expr – is an engine that can evaluate expressions.
It can handle expressions like this:
user.Group in ["good_customers", "collaborator"]
len(article.Comments) > 100 and article.Category not in ["misc"]
product.Stock < 15
all(Tickets, {.Price >0})
And also has static type checker and user-friendly error messages
error: unclosed "("
| (boo + bar]
| ----------^