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 release notes for query joins #1278

Merged
merged 4 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion release-content/0.14/release-notes/11535_Query_Joins.md
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
TODO
Queries can now be combined, returning the data for entities that are contained in both queries.

```rust
fn socratic_deduction_the_hard_way(mut all_men: Query<&Man>, mut all_mortals: Query<&Mortal>){
alice-i-cecile marked this conversation as resolved.
Show resolved Hide resolved
let n_men = all_men.iter().len();
let n_mortals = all_mortals.iter().len();

// This check is necessary but not sufficient
assert_eq!(n_men, n_mortals);

// Only entities found in *both* queries will be found in this query
let men_and_mortals: QueryLens<&Man, &Mortal> = all_men.join(all_mortals);
let n_mortal_men = men_and_mortals.iter().len();

// By contrast, this check is both necessary and sufficient!
assert_eq!(n_men, n_mortal_men);
}
```

If you're familiar with database terminology, this is an ["inner join"](https://www.w3schools.com/sql/sql_join.asp).
Other types of query joins are on the metaphorical table: please consider taking a crack at the [follow-up issue](https://github.com/bevyengine/bevy/issues/13633).
2 changes: 1 addition & 1 deletion release-content/0.14/release-notes/_release-notes.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ file_name = "11989_Implement_the_AnimationGraph_allowing_for_multiple_animati.md

[[release_notes]]
title = "Query Joins"
authors = ["@hymm","@alice-i-cecile"]
authors = ["@hymm"]
url = "https://github.com/bevyengine/bevy/pull/11535"
file_name = "11535_Query_Joins.md"

Expand Down