pub struct QueryBuilderIntegration { /* private fields */ }Expand description
Query builder integration for encrypted field validation
Validates queries to ensure encrypted fields are not used in operations that require plaintext comparison (WHERE, ORDER BY, JOIN).
Implementations§
Source§impl QueryBuilderIntegration
impl QueryBuilderIntegration
Sourcepub fn validate_where_clause(&self, fields: &[&str]) -> Result<(), SecretsError>
pub fn validate_where_clause(&self, fields: &[&str]) -> Result<(), SecretsError>
Validate that encrypted fields are not used in WHERE clause
Encrypted fields cannot be directly compared due to non-deterministic encryption (random nonces). Queries using encrypted fields in WHERE must use alternative approaches like:
- Deterministic hash of plaintext
- Separate plaintext index
- Application-level filtering
Sourcepub fn validate_order_by_clause(
&self,
fields: &[&str],
) -> Result<(), SecretsError>
pub fn validate_order_by_clause( &self, fields: &[&str], ) -> Result<(), SecretsError>
Validate that encrypted fields are not used in ORDER BY clause
Encrypted fields cannot be compared for sorting because ciphertext does not preserve plaintext order.
Sourcepub fn validate_join_condition(
&self,
fields: &[&str],
) -> Result<(), SecretsError>
pub fn validate_join_condition( &self, fields: &[&str], ) -> Result<(), SecretsError>
Validate that encrypted fields are not used in JOIN condition
Encrypted fields cannot be compared in JOIN conditions because ciphertext is non-deterministic (different every time even for same plaintext).
Sourcepub fn validate_group_by_clause(
&self,
fields: &[&str],
) -> Result<(), SecretsError>
pub fn validate_group_by_clause( &self, fields: &[&str], ) -> Result<(), SecretsError>
Validate that encrypted fields are not used in GROUP BY clause
Sourcepub fn validate_is_null_on_encrypted(
&self,
_field: &str,
) -> Result<(), SecretsError>
pub fn validate_is_null_on_encrypted( &self, _field: &str, ) -> Result<(), SecretsError>
Validate IS NULL can be used on encrypted fields
IS NULL checks NULL at database level (before encryption), so it works correctly with encrypted fields.
Sourcepub fn validate_clause(
&self,
clause_type: ClauseType,
fields: &[&str],
) -> Result<(), SecretsError>
pub fn validate_clause( &self, clause_type: ClauseType, fields: &[&str], ) -> Result<(), SecretsError>
Validate clause type contains allowed fields
Sourcepub fn encrypted_fields(&self) -> Vec<String>
pub fn encrypted_fields(&self) -> Vec<String>
Get encrypted field names
Sourcepub fn is_encrypted(&self, field: &str) -> bool
pub fn is_encrypted(&self, field: &str) -> bool
Check if field is encrypted
Sourcepub fn get_encrypted_fields_in_list(&self, fields: &[&str]) -> Vec<String>
pub fn get_encrypted_fields_in_list(&self, fields: &[&str]) -> Vec<String>
Get encrypted fields that appear in field list
Sourcepub fn validate_query(
&self,
query_type: QueryType,
where_fields: &[&str],
order_by_fields: &[&str],
join_fields: &[&str],
) -> Result<(), SecretsError>
pub fn validate_query( &self, query_type: QueryType, where_fields: &[&str], order_by_fields: &[&str], join_fields: &[&str], ) -> Result<(), SecretsError>
Validate entire query structure
Performs comprehensive validation across multiple clauses.
Auto Trait Implementations§
impl Freeze for QueryBuilderIntegration
impl RefUnwindSafe for QueryBuilderIntegration
impl Send for QueryBuilderIntegration
impl Sync for QueryBuilderIntegration
impl Unpin for QueryBuilderIntegration
impl UnwindSafe for QueryBuilderIntegration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request