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

Method rls_rules_for_table

crates/engine/src/sql/ast.rs:45–70  ·  view source on GitHub ↗
(&self, table_id: TableId)

Source from the content-addressed store, hash-verified

43 }
44
45 fn rls_rules_for_table(&self, table_id: TableId) -> anyhow::Result<Vec<Box<str>>> {
46 self.tx
47 .iter_by_col_eq(
48 ST_ROW_LEVEL_SECURITY_ID,
49 StRowLevelSecurityFields::TableId,
50 &AlgebraicValue::from(table_id),
51 )?
52 .map(|row| {
53 row.read_col::<AlgebraicValue>(StRowLevelSecurityFields::Sql)
54 .with_context(|| {
55 format!(
56 "Failed to read value from the `{}` column of `{}` for table_id `{}`",
57 "sql", "st_row_level_security", table_id
58 )
59 })
60 .and_then(|sql| {
61 sql.into_string().map_err(|_| {
62 anyhow::anyhow!(format!(
63 "Failed to read value from the `{}` column of `{}` for table_id `{}`",
64 "sql", "st_row_level_security", table_id
65 ))
66 })
67 })
68 })
69 .collect::<anyhow::Result<_>>()
70 }
71}
72
73impl<'a, T> SchemaViewer<'a, T> {

Callers

nothing calls this directly

Calls 3

mapMethod · 0.45
iter_by_col_eqMethod · 0.45
into_stringMethod · 0.45

Tested by

no test coverage detected