Skip to content

Commit 6298e0a

Browse files
Remove query builder's .build() from llm docs (#4398)
# Description of Changes Removes left over references to the query builder's `.build()` method as well as some stale C# references from `llms.md`. Only rust and C# docs needed updating. # API and ABI breaking changes None # Expected complexity level and risk 1. Small docs update # Testing N/A
1 parent d3deaee commit 6298e0a

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

docs/static/llms.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -965,13 +965,13 @@ Both contexts provide read-only access to tables and indexes through `ctx.db`.
965965
Views can return:
966966
- `Option<T>` - For at-most-one row (e.g., looking up a specific player)
967967
- `Vec<T>` - For multiple rows (e.g., listing all players at a level)
968-
- `Query<T>` - A typed SQL query that behaves like the deprecated RLS (Row-Level Security) feature
968+
- `impl Query<T>` - A typed SQL query that behaves like the deprecated RLS (Row-Level Security) feature
969969
970970
Where `T` can be a table type or any custom type derived with `SpacetimeType`.
971971
972-
**Query<T> Return Type**
972+
**impl Query<T> Return Type**
973973
974-
When a view returns `Query<T>`, SpacetimeDB computes results incrementally as the underlying data changes. This enables efficient table scanning because query results are maintained incrementally rather than recomputed from scratch. Without `Query<T>`, you must use indexed column lookups to access tables inside view functions.
974+
When a view returns `impl Query<T>`, SpacetimeDB computes results incrementally as the underlying data changes. This enables efficient table scanning because query results are maintained incrementally rather than recomputed from scratch. Without `impl Query<T>`, you must use indexed column lookups to access tables inside view functions.
975975
976976
The query builder provides a fluent API for constructing type-safe SQL queries:
977977
@@ -981,11 +981,9 @@ use spacetimedb::{view, ViewContext, Query};
981981
// This view can scan the whole table efficiently because
982982
// Query<T> results are computed incrementally
983983
#[view(accessor = my_messages, public)]
984-
fn my_messages(ctx: &ViewContext) -> Query<Message> {
985-
// Build a typed query using the query builder
986-
ctx.db.message()
987-
.filter(|cols| cols.sender.eq(ctx.sender()))
988-
.build()
984+
fn my_messages(ctx: &ViewContext) -> impl Query<Message> {
985+
// Return a typed query builder directly
986+
ctx.db.message().filter(|cols| cols.sender.eq(ctx.sender()))
989987
}
990988
991989
// Query builder supports various operations:
@@ -1870,25 +1868,23 @@ Both contexts provide read-only access to tables and indexes through `ctx.Db`.
18701868
Views can return:
18711869
- `T?` (nullable) - For at-most-one row (e.g., looking up a specific player)
18721870
- `List<T>` or `T[]` - For multiple rows (e.g., listing all players at a level)
1873-
- `Query<T>` - A typed SQL query that behaves like the deprecated RLS (Row-Level Security) feature
1871+
- `IQuery<T>` - A typed SQL query that behaves like the deprecated RLS (Row-Level Security) feature
18741872
18751873
Where `T` can be a table type or any custom type marked with `[SpacetimeDB.Type]`.
18761874
1877-
**Query<T> Return Type**
1875+
**IQuery<T> Return Type**
18781876
1879-
When a view returns `Query<T>`, SpacetimeDB computes results incrementally as the underlying data changes. This enables efficient table scanning because query results are maintained incrementally rather than recomputed from scratch. Without `Query<T>`, you must use indexed column lookups to access tables inside view functions.
1877+
When a view returns `IQuery<T>`, SpacetimeDB computes results incrementally as the underlying data changes. This enables efficient table scanning because query results are maintained incrementally rather than recomputed from scratch. Without `IQuery<T>`, you must use indexed column lookups to access tables inside view functions.
18801878
18811879
The query builder provides a fluent API for constructing type-safe SQL queries:
18821880
18831881
```csharp
18841882
// This view can scan the whole table efficiently because
1885-
// Query<T> results are computed incrementally
1883+
// IQuery<T> results are computed incrementally
18861884
[SpacetimeDB.View(Accessor = "MyMessages", Public = true)]
1887-
public static Query<Message> MyMessages(ViewContext ctx)
1885+
public static IQuery<Message> MyMessages(ViewContext ctx)
18881886
{
1889-
return ctx.Db.Message
1890-
.Filter(msg => msg.Sender == ctx.Sender)
1891-
.Build();
1887+
return ctx.Db.Message.Filter(msg => msg.Sender == ctx.Sender);
18921888
}
18931889
18941890
// Query builder supports various operations:

0 commit comments

Comments
 (0)