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

Function scan_with_select_count

tests/rust/src/query_more.rs:131–177  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

129
130#[tokio::test]
131async fn scan_with_select_count() {
132 let c = client();
133 let table = format!("ScanCount_{}", ts());
134 c.create_table()
135 .table_name(&table)
136 .key_schema(
137 KeySchemaElement::builder()
138 .attribute_name("pk")
139 .key_type(KeyType::Hash)
140 .build()
141 .unwrap(),
142 )
143 .attribute_definitions(
144 AttributeDefinition::builder()
145 .attribute_name("pk")
146 .attribute_type(ScalarAttributeType::S)
147 .build()
148 .unwrap(),
149 )
150 .billing_mode(BillingMode::PayPerRequest)
151 .send()
152 .await
153 .unwrap();
154 wait_for_active(c, &table).await;
155
156 for i in 0..4 {
157 c.put_item()
158 .table_name(&table)
159 .item("pk", s(&format!("item_{i}")))
160 .send()
161 .await
162 .unwrap();
163 }
164
165 let resp = c
166 .scan()
167 .table_name(&table)
168 .select(Select::Count)
169 .send()
170 .await
171 .unwrap();
172
173 assert_eq!(resp.count(), 4);
174 assert!(resp.items().is_empty());
175
176 c.delete_table().table_name(&table).send().await.ok();
177}
178
179#[tokio::test]
180async fn scan_with_consistent_read() {

Callers

nothing calls this directly

Calls 9

clientFunction · 0.85
sFunction · 0.85
table_nameMethod · 0.80
create_tableMethod · 0.80
put_itemMethod · 0.80
scanMethod · 0.80
delete_tableMethod · 0.80
wait_for_activeFunction · 0.70
buildMethod · 0.45

Tested by

no test coverage detected