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

Function test_multi_column_index

crates/core/src/sql/execute.rs:512–542  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

510 /// Test a query that uses a multi-column index
511 #[tokio::test]
512 async fn test_multi_column_index() -> anyhow::Result<()> {
513 let db = TestDB::in_memory()?;
514
515 let schema = [
516 ("a", AlgebraicType::U64),
517 ("b", AlgebraicType::U64),
518 ("c", AlgebraicType::U64),
519 ];
520
521 let table_id = db.create_table_for_test_multi_column("t", &schema, [1, 2].into())?;
522
523 insert_rows(
524 &db,
525 table_id,
526 vec![
527 product![0_u64, 1_u64, 2_u64],
528 product![1_u64, 2_u64, 1_u64],
529 product![2_u64, 2_u64, 2_u64],
530 ],
531 )?;
532
533 assert_query_results(
534 db.clone(),
535 "select * from t where c = 1 and b = 2",
536 AuthCtx::for_testing(),
537 [product![1_u64, 2_u64, 1_u64]],
538 )
539 .await;
540
541 Ok(())
542 }
543
544 /// Test querying a table with RLS rules
545 #[tokio::test]

Callers

nothing calls this directly

Calls 5

assert_query_resultsFunction · 0.85
insert_rowsFunction · 0.70
OkFunction · 0.50
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…