github.com/apaxa-go/eval
Package eval implements evaluation of GoLang expression at runtime. Requirements for expression: What does supported: Supported expression: Predefined types (no need to pass it via args): Implemented built-in functions (no need to pass it via args): Simple example: Complicated example: Example with error in expression: Package eval built on top of reflection, go/ast, go/parser, go/token & go/constant. To create Expression it possible to use MakeExpression or some of Parse* functions. All of them use pkgPath to control access rights. pkgPath used when: 1. Accessing struct private field. If type of struct belong to pkgPath then all access to struct fields can modify its value (for example, it is possible to set such fields in composite literal). 2. Creating type in composite literal. All created in expression structures belong to pkgPath. When Expression is ready it may be evaluated multiple times. Evaluation done via Eval* methods: In most cases EvalToInterface should be enough and it is easy to use. Evaluation performance: If you found a bug (result of this package evaluation differs from evaluation by Go itself) - please report bug at github.com/apaxa-go/eval.
proxy.golang.org
v0.0.0-20171223182326-1d18b251d679
about 8 years ago
1
6
27
Links
| Registry | proxy.golang.org |
| Source | Repository |
| Docs | Documentation |
| JSON API | View JSON |
| CodeMeta | codemeta.json |
Package Details
| PURL |
pkg:golang/github.com/apaxa-go/eval
spec |
| License | Apache-2.0 |
| Namespace | github.com/apaxa-go |
| First Release | about 8 years ago |
| Last Synced | 15 days ago |
Repository
| Stars | 52 on GitHub |
| Forks | 7 on GitHub |