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

Examples #13

Closed
ckarmy opened this issue Dec 31, 2018 · 5 comments
Closed

Examples #13

ckarmy opened this issue Dec 31, 2018 · 5 comments

Comments

@ckarmy
Copy link

ckarmy commented Dec 31, 2018

Any other example to see how to implement the methods equalto, greaterThan, MainQuery, livequeries, etc?

Thanks!

@phillwiggins
Copy link
Member

phillwiggins commented Dec 31, 2018 via email

@ckarmy
Copy link
Author

ckarmy commented Dec 31, 2018

Thanks! But I want yo build a more complex query like:

var lotsOfWins = new Parse.Query("Player");
lotsOfWins.greaterThan("wins", 150);

var fewWins = new Parse.Query("Player");
fewWins.ascending("wins");

var mainQuery = Parse.Query.or(lotsOfWins, fewWins);
mainQuery.find()
.then(function(results) {
// results contains a list of players that either have won a lot of games or won only a few games.
})
.catch(function(error) {
// There was an error.
});

It's possible or not yet?

@phillwiggins
Copy link
Member

phillwiggins commented Dec 31, 2018 via email

@ckarmy
Copy link
Author

ckarmy commented Dec 31, 2018

Thanks for the collaboration! Flutter is an incredible SDK

@phillwiggins
Copy link
Member

Hey, I think this is now possible...

var queryBuilder = QueryBuilder<DietPlan>(DietPlan())
      ..greaterThan(DietPlan.FAT, 20)
      ..descending(DietPlan.FAT);

    var response = await queryBuilder.query();

    if (response.success) {
      print("Result: ${((response.result as List<dynamic>).first as DietPlan).toString()}");
    } else {
      print("Result: ${response.exception.message}");
    }

DietPlan being a custom object that extends ParseObject as per the readme. The DietPlan.FAT is a column of that table, its static string that references the table name. Let me know if you have any issues.

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