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 3 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
16 changes: 15 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,15 @@
TODO
Queries can now be combined, returning the data for entities that are contained in both queries.

```rust
fn helper_function(a: &mut Query<&A>, b: &mut Query<&B>){
let a_and_b: QueryLens<(Entity, &A, &B)> = a.join(b);
assert!(a_and_b.iter().len() <= a.len());
assert!(a_and_b.iter().len() <= b.len());
}
```

In most cases, you should continue to simply add more parameters to your original query: `Query<&A, &B>` will generally be clearer than joining them later.
But when a complex system or helper function backs you into a corner, query joins are there if you need them.

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