Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 4.6% on proxy.golang.org
Top 1.1% forks on proxy.golang.org

proxy.golang.org : gopkg.in/antonmedv/expr.v1

Package expr is an engine that can evaluate expressions. You can pass variables into the expression, which can be of any valid Go type (including structs): Expr uses reflection for accessing and iterating passed data. For example you can pass nested structures without any modification or preparation: You can also pass functions into the expression: All methods of passed struct also available as functions inside expr: If you planning to execute some expression lots times, it's good to parse it first and only one time: Expr package support strict parse mode in which some type checks performed during parsing. To parse expression in strict mode, define all of used variables: Parse function will check used variables, accessed filed, logical operators and some other type checks. If you try to use some undeclared variables, or access unknown field, an error will be returned during paring: Also it's possible to define all used variables and functions using expr.Env and struct: Or with map: Compiled ast can be compiled back to string expression using stringer fmt.Stringer interface: Inside Expr engine there is no distinguish between int, uint and float types (as in JavaScript). All numbers inside Expr engine represented as `float64`. You should remember about it if you use any of binary operators (`+`, `-`, `/`, `*`, etc). Otherwise type remain unchanged.

Registry - Source - Documentation - JSON
purl: pkg:golang/gopkg.in/antonmedv/expr.v1
Keywords: bytecode, configuration-language, engine, evaluator, expr, expression, expression-evaluator, expression-language, go, golang, rule-engine
License: MIT
Latest release: over 5 years ago
First release: almost 6 years ago
Namespace: gopkg.in/antonmedv
Stars: 3,975 on GitHub
Forks: 300 on GitHub
See more repository details: repos.ecosyste.ms
Funding links: https://github.com/sponsors/antonmedv
Last synced: 27 days ago

    Loading...
    Readme
    Loading...