Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change query and/or to instance method to keep query non-predicate properties when joining predicates #426

Open
Steven-Chan opened this issue Jun 1, 2018 · 0 comments
Assignees

Comments

@Steven-Chan
Copy link

Steven-Chan commented Jun 1, 2018

The current function signature is

static function or(...queries)
static function and(...queries)

I suggest to change it to

function or(...queries)
function and(...queries)

// for backward compatibility
static function or(baseQuery, ...queries)
static function and(baseQuery, ...queries)

Example:

const query = new Query(xxx);
query.limit = 10;

const orQuery = query.or(xxx);
// or
const orQuery = Query.or(query, xxxx);

assert orQuery.limit === 10
// while in current implementation, orQuery.limit would be the default one

The new function signature looks more predictable,

  • this function does not work on empty query array
  • the original function does not tell how the function treat non-predicate properties
@Steven-Chan Steven-Chan changed the title Keep Query non-predicate properties when joining query predicates with and/or Change query and/or to instance method to keep query non-predicate properties when joining predicates Jun 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants