rql
rql copied to clipboard
expose field object publicly
This adds functions to expose the internal fields object and to create a new parser from a slice of field objects. This lets the user dynamically configure a parser, my use case is to change rql config based on permissions. I would also like to expose the parsed data and related field information to be able to document related metadata for the user like what are available operations. I think it pairs well with https://github.com/a8m/rql/pull/51.
I think it would be nice to refactor to the following, but this is breaking:
func NewParser(c Config, Model interface{}){}
func NewParserF(c Config, fields []*Fields){}
Added:
func NewParserF(c Config, fields []*Field) (*Parser, error) {}
func (p *Parser) GetFields() []*Field {}
Thanks for the contribution, @ashtonian. It's appreciated.