-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RLS: Adding a new filter! macro (#1849)
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com> Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
- Loading branch information
Showing
16 changed files
with
269 additions
and
22 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod ast; | ||
pub mod compiler; | ||
pub mod execute; | ||
pub mod parser; | ||
mod type_check; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use crate::db::datastore::locking_tx_datastore::MutTxId; | ||
use crate::db::relational_db::RelationalDB; | ||
use crate::sql::ast::SchemaViewer; | ||
use spacetimedb_expr::check::parse_and_type_sub; | ||
use spacetimedb_expr::errors::TypingError; | ||
use spacetimedb_expr::expr::RelExpr; | ||
use spacetimedb_expr::ty::TyCtx; | ||
use spacetimedb_lib::db::raw_def::v9::RawRowLevelSecurityDefV9; | ||
use spacetimedb_lib::identity::AuthCtx; | ||
use spacetimedb_schema::schema::RowLevelSecuritySchema; | ||
|
||
pub struct RowLevelExpr { | ||
pub sql: RelExpr, | ||
pub def: RowLevelSecuritySchema, | ||
} | ||
|
||
impl RowLevelExpr { | ||
pub fn build_row_level_expr( | ||
stdb: &RelationalDB, | ||
tx: &mut MutTxId, | ||
auth_ctx: &AuthCtx, | ||
rls: &RawRowLevelSecurityDefV9, | ||
) -> Result<Self, TypingError> { | ||
let mut ctx = TyCtx::default(); | ||
let sql = parse_and_type_sub(&mut ctx, &rls.sql, &SchemaViewer::new(stdb, tx, auth_ctx))?; | ||
|
||
Ok(Self { | ||
def: RowLevelSecuritySchema { | ||
table_id: sql.table_id(&mut ctx)?, | ||
sql: rls.sql.clone(), | ||
}, | ||
sql, | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.