rql icon indicating copy to clipboard operation
rql copied to clipboard

expose field object publicly

Open ashtonian opened this issue 2 years ago • 1 comments

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 {}

ashtonian avatar Aug 07 '23 21:08 ashtonian

Thanks for the contribution, @ashtonian. It's appreciated.

a8m avatar Aug 17 '23 05:08 a8m