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

Method get_or_make_table

sdks/rust/src/client_cache.rs:372–381  ·  view source on GitHub ↗

Called internally when updating the client cache in response to WebSocket messages, and by the codegen when initializing the client cache during [`crate::DbConnectionBuilder::build`].

(
        &mut self,
        table_name: &'static str,
    )

Source from the content-addressed store, hash-verified

370 /// Called internally when updating the client cache in response to WebSocket messages,
371 /// and by the codegen when initializing the client cache during [`crate::DbConnectionBuilder::build`].
372 pub fn get_or_make_table<Row: InModule<Module = M> + Send + Sync + 'static>(
373 &mut self,
374 table_name: &'static str,
375 ) -> &mut TableCache<Row> {
376 self.tables
377 .entry::<HashMap<&'static str, TableCache<Row>>>()
378 .or_default()
379 .entry(table_name)
380 .or_insert_with(|| TableCache::new(self.extra_logging.clone()))
381 }
382
383 /// Apply all the mutations in `diff`
384 /// to the [`TableCache`] which stores rows of type `Row` for the table `table_name`.

Callers

nothing calls this directly

Calls 3

entryMethod · 0.80
newFunction · 0.50
cloneMethod · 0.45

Tested by

no test coverage detected