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

Add custom filters when doing queries #1363

Closed
aymericdelab opened this issue Aug 25, 2023 · 1 comment
Closed

Add custom filters when doing queries #1363

aymericdelab opened this issue Aug 25, 2023 · 1 comment

Comments

@aymericdelab
Copy link

aymericdelab commented Aug 25, 2023

Following @alvrs comment here: https://discord.com/channels/865335009915961364/1029021716367806514/1144301124447371344

Goal would be to create a "Filter" query fragment that takes a component as first parameter and a filter function as second parameter.

Steps to make this would be:

  1. Add new fragment type here: https://github.com/latticexyz/mud/blob/main/packages/recs/src/Query.ts
  2. Add a case to passesQueryFragment
  3. Add it to isPositiveFragment

Example:

// only retrieve entities that have a position x and y bigger than 1000
let entities = runQuery([Has(Position), Filter(Position, ({x, y}) => x > 1000, y > 1000)]);
@holic
Copy link
Member

holic commented Mar 21, 2024

this will be happening via #2272

@holic holic closed this as completed Mar 21, 2024
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