GithubHelp home page GithubHelp logo

Comments (4)

mkeeler avatar mkeeler commented on August 23, 2024

@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.

mkeeler avatar mkeeler commented on August 23, 2024

Enhancement:

• Allow for lazy field selector validation through interface{} types.

from go-bexpr.

akamensky avatar akamensky commented on August 23, 2024

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.

antonmedv avatar antonmedv commented on August 23, 2024

@akamensky you can restrict it to booleans only: https://godoc.org/github.com/antonmedv/expr#AsBool

from go-bexpr.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.