Skip to content

Create Test of C# Code Generation for Tables with BTree indexes of type Identity #2362

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

Closed
rekhoff opened this issue Mar 7, 2025 · 1 comment
Assignees

Comments

@rekhoff
Copy link
Contributor

rekhoff commented Mar 7, 2025

Action to perform:

Add a test to com.clockworklabs.spacetimedbsdk that checks code generation of a Table with an index of type btree of an Identity type is generating C# code as intended.
Manually performed example from #2354 that should be reproduced in an automated test:

  1. Created a test project with a Rust server defining a table with a btree index like:
#[index(btree)]
pub identity: Identity,

and another where a table was defined with:
#[spacetimedb::table(name = period_timer, scheduled(period, at = scheduled_at), index(name = identity, btree(columns = [identity])))]
2. Published the server.
3. Created a C# client and generated the bindings.
4. Confirmed issue existed prior to change: IDE reports an error in the table definition of The type 'SpacetimeDB.Identity' must be convertible to 'System.IComparable<SpacetimeDB.Identity>' in order to use it as parameter 'Column' in the generic class 'SpacetimeDB.RemoteTableHandle<EventContext,Row>.BTreeIndexBase<Column>'
5. Made change contained in this PR.
6. Rebuilt SpacetimeDB executables, and C# SDK NuGet files.
7. Tested again by republishing and regenerating bindings.
8. Observed IDE no longer reports issue.

Ticket Generated from the comment:
#2354 (review)

@rekhoff
Copy link
Contributor Author

rekhoff commented Mar 21, 2025

After the implementation of IComparable to BTreeIndexBase was added, the resulting generated code for the C# client wasn't changed, so testing for that behavior is not possible. You can, however, test that BTreeIndexBase implements the IComparable interface. With that goal in mind, clockworklabs/com.clockworklabs.spacetimedbsdk#277 was opened for that change.

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

1 participant