MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / insert_rows

Function insert_rows

crates/core/src/sql/execute.rs:477–488  ·  view source on GitHub ↗

Insert product values into a table

(
        db: &RelationalDB,
        table_id: TableId,
        rows: impl IntoIterator<Item = ProductValue>,
    )

Source from the content-addressed store, hash-verified

475
476 /// Insert product values into a table
477 fn insert_rows(
478 db: &RelationalDB,
479 table_id: TableId,
480 rows: impl IntoIterator<Item = ProductValue>,
481 ) -> anyhow::Result<()> {
482 with_auto_commit(db, |tx| {
483 for row in rows.into_iter() {
484 db.insert(tx, table_id, &row.to_bsatn_vec()?)?;
485 }
486 Ok(())
487 })
488 }
489
490 /// Assert this query returns the expected rows for this user
491 async fn assert_query_results(

Callers 5

test_multi_column_indexFunction · 0.70
test_rls_rulesFunction · 0.70
test_nested_rls_rulesFunction · 0.70
test_project_joinFunction · 0.70

Calls 5

with_auto_commitFunction · 0.85
insertMethod · 0.65
OkFunction · 0.50
into_iterMethod · 0.45
to_bsatn_vecMethod · 0.45

Tested by 5

test_multi_column_indexFunction · 0.56
test_rls_rulesFunction · 0.56
test_nested_rls_rulesFunction · 0.56
test_project_joinFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…