MCPcopy Create free account
hub / github.com/ExtendDB/extenddb / create_item

Function create_item

tests/rust/src/test_base.rs:400–425  ·  view source on GitHub ↗

Create an item with appropriate keys for the given table.

(table_name: &str)

Source from the content-addressed store, hash-verified

398
399/// Create an item with appropriate keys for the given table.
400pub fn create_item(table_name: &str) -> HashMap<String, AttributeValue> {
401 let unique = Uuid::new_v4().to_string();
402 let mut item = HashMap::new();
403
404 if table_name.starts_with("SimpleKeyString") {
405 item.insert(HASH_KEY_S.into(), s(&unique));
406 } else if table_name.starts_with("CompKeyStringNumber") {
407 item.insert(HASH_KEY_S.into(), s(&unique));
408 item.insert(RANGE_KEY_N.into(), n(unique_range()));
409 } else if table_name.starts_with("CompKeyBlobNumber") {
410 item.insert(HASH_KEY_B.into(), b(&unique));
411 item.insert(RANGE_KEY_N.into(), n(unique_range()));
412 } else if table_name.starts_with("CompKeyNumberString") {
413 item.insert(HASH_KEY_N.into(), n(unique_range()));
414 item.insert(RANGE_KEY_S.into(), s(&unique));
415 } else if table_name.starts_with("CompKeyStringStringGSI") {
416 item.insert(HASH_KEY_S.into(), s(&unique));
417 item.insert(RANGE_KEY_S.into(), s(&format!("range_{unique}")));
418 } else {
419 item.insert(HASH_KEY_S.into(), s(&unique));
420 }
421
422 item.insert("str".into(), s(&format!("testValue_{}", &unique[..8])));
423 item.insert("num".into(), n(42));
424 item
425}
426
427/// Create an item with GSI key attributes.
428pub fn create_item_with_gsi(table_name: &str) -> HashMap<String, AttributeValue> {

Callers 15

query_gsi_basicFunction · 0.85
query_gsi_multiple_itemsFunction · 0.85
query_gsi_with_filterFunction · 0.85
set_arithmetic_decrementFunction · 0.85
set_list_appendFunction · 0.85
set_list_prependFunction · 0.85
set_nested_attributeFunction · 0.85

Calls 5

sFunction · 0.85
nFunction · 0.85
unique_rangeFunction · 0.85
bFunction · 0.85
insertMethod · 0.80

Tested by

no test coverage detected