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

Function query_gsi_basic

tests/rust/src/gsi.rs:9–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7
8#[tokio::test]
9async fn query_gsi_basic() {
10 let c = client();
11 let t = tables().await;
12 let table = &t.simple_key_string_gsi;
13 let gsi_hash = format!("gsi_qb_{}", ts());
14
15 let mut item = create_item(table);
16 item.insert(GSI_HASH_KEY.into(), s(&gsi_hash));
17 item.insert(GSI_RANGE_KEY.into(), s("r1"));
18 c.put_item()
19 .table_name(table)
20 .set_item(Some(item.clone()))
21 .send()
22 .await
23 .unwrap();
24
25 tokio::time::sleep(std::time::Duration::from_secs(2)).await;
26
27 let resp = c
28 .query()
29 .table_name(table)
30 .index_name(GSI_NAME)
31 .key_condition_expression("#h = :hv")
32 .expression_attribute_names("#h", GSI_HASH_KEY)
33 .expression_attribute_values(":hv", s(&gsi_hash))
34 .send()
35 .await
36 .unwrap();
37
38 assert_eq!(resp.count(), 1);
39}
40
41#[tokio::test]
42async fn query_gsi_multiple_items() {

Callers

nothing calls this directly

Calls 9

clientFunction · 0.85
tablesFunction · 0.85
create_itemFunction · 0.85
sFunction · 0.85
insertMethod · 0.80
table_nameMethod · 0.80
put_itemMethod · 0.80
cloneMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected