Skip to content

Conversation

mamcx
Copy link
Contributor

@mamcx mamcx commented Jul 30, 2025

Description of Changes

As the title says.

Closes #2650

Expected complexity level and risk

1

Testing

NOTE : Need input in what other testing to add

  • Add testing for Comparable in the C# side
  • Also that it compiles in module

@mamcx mamcx self-assigned this Jul 30, 2025
@mamcx mamcx added enhancement New feature or request release-any To be landed in any release window labels Jul 30, 2025
@mamcx mamcx force-pushed the mamcx/filterable-timestamp-duration-bytes branch 2 times, most recently from 390f24c to 0c0e262 Compare July 31, 2025 18:20
@mamcx mamcx requested review from rekhoff and jsdt July 31, 2025 19:02
@mamcx mamcx marked this pull request as ready for review July 31, 2025 19:02
Copy link
Contributor

@jsdt jsdt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the implications of being a filterable value? Does that mean tables can have indexes on fields of that type, or just that sql queries can filter on those fields?

/**
* Compares the current instance with another object of the same type.
*/
interface Comparable<T> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the implications of being a filterable value?

It means a Filter functions is generated for this field, but you can filter with sql any field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used?

Is removed now, was before agreement to not mirror yet the filterable trait

@@ -1,6 +1,8 @@
use crate::{ConnectionId, Identity};
use core::ops;
use spacetimedb_sats::bsatn;
use spacetimedb_sats::time_duration::TimeDuration;
use spacetimedb_sats::timestamp::Timestamp;
use spacetimedb_sats::{hash::Hash, i256, u256, Serialize};

/// Types which can appear as an argument to an index filtering operation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add Timestamp and TimeDuration to the of types specifically called out as having corresponding FilterableValue implementations in this comment block.

@@ -171,6 +171,18 @@ public partial struct Player
public string name;
}

// Extra table for checking implementation of `FilterableValue` trait
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are adding a table to specifically check for the FilterableValue trait, we should add the other filterable types as well.

@mamcx mamcx force-pushed the mamcx/filterable-timestamp-duration-bytes branch 2 times, most recently from 4e53b8a to e190de1 Compare August 4, 2025 16:24
@mamcx mamcx force-pushed the mamcx/filterable-timestamp-duration-bytes branch from e190de1 to 4c9c51f Compare August 7, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request release-any To be landed in any release window
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Timestamp implement FilterableValue
3 participants