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

Method createBTreeIndex

crates/bindings-cpp/src/internal/v9_builder.cpp:326–341  ·  view source on GitHub ↗

Helper to create a BTree index for a field

Source from the content-addressed store, hash-verified

324
325// Helper to create a BTree index for a field
326RawIndexDefV9 V9Builder::createBTreeIndex(const std::string& table_name,
327 const std::string& field_name,
328 uint16_t field_idx) const {
329 RawIndexAlgorithmBTreeData btree_data;
330 btree_data.columns = {field_idx};
331
332 RawIndexAlgorithm algorithm;
333 algorithm.set<0>(btree_data); // Set BTree variant
334
335 RawIndexDefV9 index_def;
336 index_def.name = table_name + "_" + field_name + "_idx_btree";
337 index_def.accessor_name = field_name;
338 index_def.algorithm = algorithm;
339
340 return index_def;
341}
342
343// Helper to create a unique constraint for a field
344RawConstraintDefV9 V9Builder::createUniqueConstraint(const std::string& table_name,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected