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

Function assert_query_results

crates/core/src/sql/execute.rs:491–508  ·  view source on GitHub ↗

Assert this query returns the expected rows for this user

(
        db: Arc<RelationalDB>,
        sql: &str,
        auth: AuthCtx,
        expected: impl IntoIterator<Item = ProductValue>,
    )

Source from the content-addressed store, hash-verified

489
490 /// Assert this query returns the expected rows for this user
491 async fn assert_query_results(
492 db: Arc<RelationalDB>,
493 sql: &str,
494 auth: AuthCtx,
495 expected: impl IntoIterator<Item = ProductValue>,
496 ) {
497 assert_eq!(
498 run(db, sql.to_string(), auth.clone(), None, None, &mut vec![])
499 .await
500 .unwrap()
501 .rows
502 .into_iter()
503 .sorted()
504 .dedup()
505 .collect::<Vec<_>>(),
506 expected.into_iter().sorted().dedup().collect::<Vec<_>>()
507 );
508 }
509
510 /// Test a query that uses a multi-column index
511 #[tokio::test]

Callers 8

test_multi_column_indexFunction · 0.85
test_rls_rulesFunction · 0.85
test_nested_rls_rulesFunction · 0.85
test_project_joinFunction · 0.85
test_viewFunction · 0.85
test_anonymous_viewFunction · 0.85
test_view_join_tableFunction · 0.85
test_view_join_viewFunction · 0.85

Calls

no outgoing calls

Tested by 8

test_multi_column_indexFunction · 0.68
test_rls_rulesFunction · 0.68
test_nested_rls_rulesFunction · 0.68
test_project_joinFunction · 0.68
test_viewFunction · 0.68
test_anonymous_viewFunction · 0.68
test_view_join_tableFunction · 0.68
test_view_join_viewFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…