@@ -10,17 +10,17 @@ pub mod rt;
1010pub mod time_span;
1111mod timestamp;
1212
13+ use crate :: sats:: db:: attr:: ColumnAttribute ;
1314use crate :: sats:: db:: def:: IndexType ;
1415use spacetimedb_lib:: buffer:: { BufReader , BufWriter , Cursor , DecodeError } ;
1516use spacetimedb_lib:: sats:: { impl_deserialize, impl_serialize, impl_st} ;
16- use spacetimedb_lib:: { bsatn, PrimaryKey , ProductType , ProductValue } ;
17+ use spacetimedb_lib:: { bsatn, ProductType , ProductValue } ;
1718use std:: cell:: RefCell ;
1819use std:: marker:: PhantomData ;
1920use std:: slice:: from_ref;
2021use std:: { fmt, panic} ;
2122use sys:: { Buffer , BufferIter } ;
2223
23- use crate :: sats:: db:: attr:: ColumnAttribute ;
2424pub use log;
2525pub use sats:: SpacetimeType ;
2626pub use spacetimedb_bindings_macro:: { duration, query, spacetimedb, TableType } ;
@@ -440,11 +440,6 @@ impl<T: TableType> sealed::InsertResult for T {
440440/// then so are the values in their serialized representation.
441441pub trait FilterableValue : Serialize + Eq { }
442442
443- /// A trait for types that can be converted into primary keys.
444- pub trait UniqueValue : FilterableValue {
445- fn into_primarykey ( self ) -> PrimaryKey ;
446- }
447-
448443#[ doc( hidden) ]
449444pub mod query {
450445 use super :: * ;
@@ -470,7 +465,7 @@ pub mod query {
470465 #[ doc( hidden) ]
471466 pub fn filter_by_unique_field <
472467 Table : TableType + FieldAccess < COL_IDX , Field = T > ,
473- T : UniqueValue ,
468+ T : FilterableValue ,
474469 const COL_IDX : u8 ,
475470 > (
476471 val : & T ,
@@ -531,7 +526,7 @@ pub mod query {
531526 /// **NOTE:** Do not use directly.
532527 /// This is exposed as `delete_by_{$field_name}` on types with `#[spacetimedb(table)]`
533528 /// where the field has a unique constraint.
534- pub fn delete_by_unique_field < Table : TableType , T : UniqueValue , const COL_IDX : u8 > ( val : & T ) -> bool {
529+ pub fn delete_by_unique_field < Table : TableType , T : FilterableValue , const COL_IDX : u8 > ( val : & T ) -> bool {
535530 let count = delete_by_field :: < Table , T , COL_IDX > ( val) ;
536531 debug_assert ! ( count <= 1 ) ;
537532 count > 0
@@ -545,7 +540,7 @@ pub mod query {
545540 /// **NOTE:** Do not use directly.
546541 /// This is exposed as `update_by_{$field_name}` on types with `#[spacetimedb(table)]`.
547542 #[ doc( hidden) ]
548- pub fn update_by_field < Table : TableType , T : UniqueValue , const COL_IDX : u8 > ( old : & T , new : Table ) -> bool {
543+ pub fn update_by_field < Table : TableType , T : FilterableValue , const COL_IDX : u8 > ( old : & T , new : Table ) -> bool {
549544 // Delete the existing row, if any.
550545 delete_by_field :: < Table , T , COL_IDX > ( old) ;
551546
0 commit comments