Skip to content
This repository has been archived by the owner on Mar 18, 2021. It is now read-only.

Change behavior of ManagedSet.haveAtLeastOneWhere #481

Open
joeconwaystk opened this issue Jul 3, 2018 · 4 comments
Open

Change behavior of ManagedSet.haveAtLeastOneWhere #481

joeconwaystk opened this issue Jul 3, 2018 · 4 comments

Comments

@joeconwaystk
Copy link
Contributor

This is getting hung by by stricter type checks, and wasn't the best solution in the first place. The preferred solution would be have variants of this expression behavior, and to also remove its signature from ManagedSet because it is misleading.

Preliminary research has shown that a preferable API might be the following:

query.where((o) => o.children).have(anyOf: (child) => child.field).equalTo(...);
query.where((o) => o.children).have(noneOf: (child) => child.field).equalTo(...);
query.where((o) => o.children).have(allOf: (child) => child.field).equalTo(...);

Issues are that QueryExpression<T, U> expects to retain the type argument U (the object type being queried) throughout the expression chain, but this may be worth looking at if it is even viable.

@illia-romanenko
Copy link

Hi @joeconwaystk - so as far as I understand

haveAtLeastOneWhere

has been removed and there is no replacement for it at the moment? If that's so then the doc probably should be updated https://aqueduct.io/docs/db/advanced_queries/

@kovac777
Copy link

kovac777 commented Nov 2, 2020

@joeconwaystk Hello! I very need an example of usage without haveAtLeastOneWhere

@jayjah
Copy link

jayjah commented Nov 2, 2020

Example:

var query = new Query<Team>(context)
  ..where((t) => t.players.haveAtLeastOneWhere.yearsPlayed).lessThanOrEqualTo(1);

var teamsWithRookies = await query.fetch();

@kovac777
Copy link

kovac777 commented Nov 2, 2020

@jayjah Yes, but haveAtLeastOneWhere was removed and now I don't see alter solutions

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

4 participants