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

Function create_table_raw

tests/rust/src/test_base.rs:253–297  ·  view source on GitHub ↗
(
    c: &Client,
    name: &str,
    hash_key: &str,
    range_key: Option<&str>,
    attr_defs: Vec<AttributeDefinition>,
    gsis: Option<Vec<GlobalSecondaryIndex>>,
)

Source from the content-addressed store, hash-verified

251}
252
253async fn create_table_raw(
254 c: &Client,
255 name: &str,
256 hash_key: &str,
257 range_key: Option<&str>,
258 attr_defs: Vec<AttributeDefinition>,
259 gsis: Option<Vec<GlobalSecondaryIndex>>,
260) {
261 let mut key_schema = vec![KeySchemaElement::builder()
262 .attribute_name(hash_key)
263 .key_type(KeyType::Hash)
264 .build()
265 .unwrap()];
266
267 if let Some(rk) = range_key {
268 key_schema.push(
269 KeySchemaElement::builder()
270 .attribute_name(rk)
271 .key_type(KeyType::Range)
272 .build()
273 .unwrap(),
274 );
275 }
276
277 let mut req = c
278 .create_table()
279 .table_name(name)
280 .billing_mode(BillingMode::PayPerRequest)
281 .set_key_schema(Some(key_schema))
282 .set_attribute_definitions(Some(attr_defs));
283
284 if let Some(g) = gsis {
285 req = req.set_global_secondary_indexes(Some(g));
286 }
287
288 match req.send().await {
289 Ok(_) => {}
290 Err(e) => {
291 if err_code(&e) != Some("ResourceInUseException") {
292 panic!("Failed to create table {name}: {e:?}");
293 }
294 }
295 }
296 wait_for_active(c, name).await;
297}
298
299async fn create_table_with_gsi(
300 c: &Client,

Callers 2

create_tableFunction · 0.85
create_table_with_gsiFunction · 0.85

Calls 5

err_codeFunction · 0.85
table_nameMethod · 0.80
create_tableMethod · 0.80
wait_for_activeFunction · 0.70
buildMethod · 0.45

Tested by

no test coverage detected