Function spacetimedb::delete_by_rel

source ·
pub fn delete_by_rel(
    table_id: TableId,
    relation: &[impl Serialize]
) -> Result<u32>
Expand description

Deletes those rows, in the table identified by table_id, that match any row in relation.

The relation will be BSATN encoded to [ProductValue] i.e., a list of product values, so each element in relation must serialize to what a ProductValue would in BSATN.

Matching is then defined by first BSATN-decoding the resulting bsatn to a Vec<ProductValue> according to the row schema of the table and then using Ord for AlgebraicValue.

Returns the number of rows deleted.

Returns an error if

  • a table with the provided table_id doesn’t exist
  • (relation, relation_len) doesn’t decode from BSATN to a Vec<ProductValue>

Panics when serialization fails.