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

Function reformat_query_rows

crates/cli/src/subcommands/subscribe.rs:737–757  ·  view source on GitHub ↗

Convert v3 initial subscription rows to the normalized table output map.

(
    msg: &'a ws_v2::QueryRows,
    schema: &RawModuleDefV9,
)

Source from the content-addressed store, hash-verified

735
736/// Convert v3 initial subscription rows to the normalized table output map.
737fn reformat_query_rows<'a>(
738 msg: &'a ws_v2::QueryRows,
739 schema: &RawModuleDefV9,
740) -> anyhow::Result<HashMap<&'a str, SubscriptionTable>> {
741 let mut formatted = HashMap::default();
742
743 for table in &msg.tables {
744 let table_ty = schema.typespace.resolve(
745 schema
746 .type_ref_for_table_like(&table.table)
747 .context("table not found in schema")?,
748 );
749 let table_output = formatted.entry(&*table.table).or_insert_with(|| SubscriptionTable {
750 deletes: Vec::new(),
751 inserts: Vec::new(),
752 });
753 table_output.inserts.extend(reformat_bsatn_rows(&table.rows, table_ty)?);
754 }
755
756 Ok(formatted)
757}
758
759/// Convert a v3 transaction update to the normalized table output map.
760fn reformat_transaction_update<'a>(

Callers 1

Calls 7

reformat_bsatn_rowsFunction · 0.85
entryMethod · 0.80
newFunction · 0.50
OkFunction · 0.50
resolveMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…