Function spacetimedb_bindings_sys::insert

source ·
pub fn insert(table_id: TableId, row: &mut [u8]) -> Result<(), Errno>
Expand description

Inserts a row into the table identified by table_id, where the row is a BSATN-encoded ProductValue matching the table’s ProductType row-schema.

The row is &mut due to auto-incrementing columns. So row is written to with the inserted row re-encoded.

Returns an error if

  • a table with the provided table_id doesn’t exist
  • there were unique constraint violations
  • row doesn’t decode from BSATN to a ProductValue according to the ProductType that the table’s schema specifies.