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

Method insert

crates/bindings-cpp/include/spacetimedb/table.h:385–393  ·  view source on GitHub ↗

* Insert a row and return it with auto-generated fields populated. * * For tables with auto-increment fields (defined with FIELD_PrimaryKeyAutoInc, * FIELD_UniqueAutoInc, FIELD_IndexAutoInc, or FIELD_AutoInc), this method * automatically integrates the generated values back into the returned row. * * @param row_data The row to insert. Auto-increment fields can be set

Source from the content-addressed store, hash-verified

383 * value integration automatically.
384 */
385 T insert(const T& row_data) {
386 auto result = try_insert(row_data);
387 if (result.is_err()) {
388 const auto& error = result.err();
389 // Convert to LOG_FATAL to maintain current behavior
390 LOG_FATAL("Table::insert failed: " + error.message);
391 }
392 return result.take_ok();
393 }
394
395 /**
396 * Insert a row and return Result-like type instead of throwing on error.

Callers

nothing calls this directly

Calls 2

errMethod · 0.80
is_errMethod · 0.45

Tested by

no test coverage detected