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

Function SPACETIMEDB_REDUCER

modules/benchmarks-cpp/src/circles.cpp:74–85  ·  view source on GitHub ↗

Bulk insert entities with auto-incremented IDs

Source from the content-addressed store, hash-verified

72
73// Bulk insert entities with auto-incremented IDs
74SPACETIMEDB_REDUCER(insert_bulk_entity, ReducerContext& ctx, uint32_t count) {
75 for (uint32_t id = 0; id < count; ++id) {
76 Entity new_entity = {
77 0, // Auto-incremented by database
78 {static_cast<float>(id), static_cast<float>(id + 5)}, // position
79 id * 5 // mass
80 };
81 ctx.db[entity].insert(new_entity);
82 }
83 LOG_INFO("INSERT ENTITY: " + std::to_string(count));
84 return Ok();
85}
86
87// Bulk insert circles with specified entity and player IDs
88SPACETIMEDB_REDUCER(insert_bulk_circle, ReducerContext& ctx, uint32_t count) {

Callers

nothing calls this directly

Calls 13

black_boxFunction · 0.85
insert_bulk_foodFunction · 0.85
insert_bulk_entityFunction · 0.85
insert_bulk_circleFunction · 0.85
cross_join_circle_foodFunction · 0.85
cross_join_allFunction · 0.85
is_overlappingFunction · 0.70
insertMethod · 0.65
to_stringFunction · 0.50
OkFunction · 0.50
ErrFunction · 0.50
findMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…