Comments (4)
@akamensky This library is really intended for filtering outputs of structured data at the moment.
Internally we generate potential selectable fields from the data type not the datas value. So in the case of map[string]interface{}
we end up with no selectable fields as we have no way of knowing what might be behind that interface{}
.
Currently evaluation ensures that only those fields that we know about from during the introspection of the data type are used and only those operations that we know should be allowed based on the original data are used. In fact we take a preliminary pass and validating all fields used in an expression with the field configuration prior to evaluating anything.
While we could potentially allow for more lazy expression validation during evaluation its not something that fits into the core use cases behind creating this library (which really was to have the ability to filter API outputs rather than inputs. For now at least your best bet is probably to use an alternative library. https://github.com/antonmedv/expr is one which I have seen and is geared towards more general use cases I believe.
from go-bexpr.
Enhancement:
• Allow for lazy field selector validation through interface{}
types.
from go-bexpr.
For now at least your best bet is probably to use an alternative library. https://github.com/antonmedv/expr is one which I have seen and is geared towards more general use cases I believe.
I already looked at https://github.com/antonmedv/expr, but while it can do exactly just that, it does not restrict expressions to boolean only, and in my use case I need exactly only boolean expressions and not allow any other types to be returned. From the expression syntax perspective this library would fit my needs best.
Thanks anyway for your response, looks like I would have to stick with expr for now.
from go-bexpr.
@akamensky you can restrict it to booleans only: https://godoc.org/github.com/antonmedv/expr#AsBool
from go-bexpr.
Related Issues (10)
- Implement better support for embedded/anonymous types HOT 1
- How to support "in query" like SQL? HOT 2
- Operator Resolution Order HOT 2
- List of operators?
- Implement support of cyclical data structures.
- Comparisons against missing map keys return an error unless preceded by an "in" check
- expr HOT 2
- GitHub Actions - deprecated warnings found - action required!
- If a string starts from a number, then error occurs HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-bexpr.