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

Function create_table_from_def

crates/engine/src/update.rs:429–439  ·  view source on GitHub ↗

Creates the table for `table_def` in `stdb`.

(
    stdb: &RelationalDB,
    tx: &mut MutTxId,
    module_def: &ModuleDef,
    table_def: &TableDef,
)

Source from the content-addressed store, hash-verified

427
428/// Creates the table for `table_def` in `stdb`.
429pub fn create_table_from_def(
430 stdb: &RelationalDB,
431 tx: &mut MutTxId,
432 module_def: &ModuleDef,
433 table_def: &TableDef,
434) -> anyhow::Result<()> {
435 let schema = TableSchema::from_module_def(module_def, table_def, (), TableId::SENTINEL);
436 stdb.create_table(tx, schema)
437 .with_context(|| format!("failed to create table {}", &table_def.name))?;
438 Ok(())
439}
440
441#[cfg(test)]
442mod test {

Calls 2

OkFunction · 0.50
create_tableMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…