Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Update filters generators to provide more flexible format #2743

Closed
nazarhussain opened this issue Jan 15, 2019 · 2 comments
Closed

Update filters generators to provide more flexible format #2743

nazarhussain opened this issue Jan 15, 2019 · 2 comments

Comments

@nazarhussain
Copy link
Contributor

Currently the filters generation support the following syntax.

(a = 1 AND b = 2) OR (a = 2 AND b = 3)

We need to support following syntax as well:

(a = 1 OR b = 2) AND (a = 2 OR b = 3)

or mix of both

(a = 1 OR b = 2) AND ( (a = 1 AND b = 2) OR (a = 2 AND b = 3) )
@nazarhussain
Copy link
Contributor Author

Its a nice to have feature, and should be implemented in following pattern later in some time.

	/**
	 * Parse provided filters and generate valid SQL
	 *
	 * @param {string|Object|Array.<Object>} filters
	 * @param {Object} options
	 * @param {string} options.filterPrefix
	 * @return {string}
	 *
	 * @description
	 *
	 * * Filters can be provided as strings or object or array of objects and strings
	 * * Object type filters will always be combined with *AND* combinator
	 * * Array type filters will always be combined with *OR* combinator
	 * * String values type (AND, OR) can be added as array elements to and used a combinator
	 *
	 * @example
	 * Filters can provided in following format to generate these conditions
	 *
	 * 		{a: 1, b: 2} 						-> (a = 1 AND b = 2)
	 * 		[{a: 1, b: 2}, {c: 3}] 				-> (a = 1 AND b = 2) OR (c = 3)
	 * 		[[{a: 1}, {b: 2}], {c: 3}] 		-> (a = 1 OR b = 2) OR (c = 3)
	 * 		[[{a: 1}, {b: 2}], 'AND', {c: 3}] 		-> (a = 1 OR b = 2) AND (c = 3)
	 */

@shuse2
Copy link
Collaborator

shuse2 commented May 13, 2020

Closing this in favor of #5238

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants