Skip to content

Add docs for indexable types to C# #285

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

Merged
merged 1 commit into from
Apr 16, 2025
Merged
Changes from all 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
13 changes: 12 additions & 1 deletion docs/modules/c-sharp/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,17 @@ public partial struct AcademicPaper {

Any table supports getting an [`Index`](#class-index) using `ctx.Db.{table}.{index}`. For example, `ctx.Db.academic_paper.TitleAndDate` or `ctx.Db.academic_paper.Venue`.

## Indexable Types

SpacetimeDB supports only a restricted set of types as index keys:

- Signed and unsigned integers of various widths.
- `bool`.
- `string`.
- [`Identity`](#struct-identity).
- [`ConnectionId`](#struct-connectionid).
- `enum`s annotated with [`SpacetimeDB.Type`](#attribute-spacetimedbtype).

## Class `Index`

```csharp
Expand Down Expand Up @@ -1391,4 +1402,4 @@ Stored in reducer-scheduling tables as a column.
[`DateTimeOffset`]: https://learn.microsoft.com/en-us/dotnet/api/system.datetimeoffset?view=net-9.0
[`TimeSpan`]: https://learn.microsoft.com/en-us/dotnet/api/system.timespan?view=net-9.0
[unix epoch]: https://en.wikipedia.org/wiki/Unix_time
[`System.Random`]: https://learn.microsoft.com/en-us/dotnet/api/system.random?view=net-9.0
[`System.Random`]: https://learn.microsoft.com/en-us/dotnet/api/system.random?view=net-9.0