Skip to content
Open
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
8 changes: 5 additions & 3 deletions crates/lib/src/filterable_value.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{ConnectionId, Identity};
use crate::{ConnectionId, Identity, Uuid};
use core::ops;
use spacetimedb_sats::bsatn;
use spacetimedb_sats::{hash::Hash, i256, u256, Serialize};
Expand All @@ -15,6 +15,7 @@ use spacetimedb_sats::{hash::Hash, i256, u256, Serialize};
/// - [`bool`].
/// - [`String`], which is also filterable with `&str`.
/// - [`Identity`].
/// - [`Uuid`].
/// - [`ConnectionId`].
/// - [`Hash`](struct@Hash).
/// - No-payload enums annotated with `#[derive(SpacetimeType)]`.
Expand All @@ -37,8 +38,8 @@ use spacetimedb_sats::{hash::Hash, i256, u256, Serialize};
// E.g. `&str: FilterableValue<Column = String>` is desirable.
#[diagnostic::on_unimplemented(
message = "`{Self}` cannot appear as an argument to an index filtering operation",
label = "should be an integer type, `bool`, `String`, `&str`, `Identity`, `ConnectionId`, `Hash` or a no-payload enum which derives `SpacetimeType`, not `{Self}`",
note = "The allowed set of types are limited to integers, bool, strings, `Identity`, `ConnectionId`, `Hash` and no-payload enums which derive `SpacetimeType`,"
label = "should be an integer type, `bool`, `String`, `&str`, `Identity` , `Uuid`, `ConnectionId`, `Hash` or a no-payload enum which derives `SpacetimeType`, not `{Self}`",
note = "The allowed set of types are limited to integers, bool, strings, `Identity`, `Uuid`, `ConnectionId`, `Hash` and no-payload enums which derive `SpacetimeType`,"
)]
pub trait FilterableValue: Serialize + Private {
type Column;
Expand Down Expand Up @@ -94,6 +95,7 @@ impl_filterable_value! {
&str => String,

Identity: Copy,
Uuid: Copy,
ConnectionId: Copy,
Hash: Copy,

Expand Down