pub struct SafeQueryBuilder { /* private fields */ }Expand description
Safe query builder to prevent SQL injection vulnerabilities
Implementations§
Source§impl SafeQueryBuilder
impl SafeQueryBuilder
pub fn new(base_query: &str) -> Self
Sourcepub fn add_condition(&mut self, condition: &str) -> &mut Self
pub fn add_condition(&mut self, condition: &str) -> &mut Self
Add a parameterized condition safely
Sourcepub fn add_tier_filter(&mut self, tier: &MemoryTier) -> &mut Self
pub fn add_tier_filter(&mut self, tier: &MemoryTier) -> &mut Self
Add a parameterized tier filter
Sourcepub fn add_date_range(
&mut self,
start: Option<&DateTime<Utc>>,
end: Option<&DateTime<Utc>>,
) -> &mut Self
pub fn add_date_range( &mut self, start: Option<&DateTime<Utc>>, end: Option<&DateTime<Utc>>, ) -> &mut Self
Add a parameterized date range filter
Sourcepub fn add_importance_range(
&mut self,
min: Option<f64>,
max: Option<f64>,
) -> &mut Self
pub fn add_importance_range( &mut self, min: Option<f64>, max: Option<f64>, ) -> &mut Self
Add a parameterized importance range filter
Sourcepub fn add_similarity_threshold(&mut self, threshold: f64) -> &mut Self
pub fn add_similarity_threshold(&mut self, threshold: f64) -> &mut Self
Add a parameterized similarity threshold
Sourcepub fn add_consolidation_strength_range(
&mut self,
min: Option<f64>,
max: Option<f64>,
) -> &mut Self
pub fn add_consolidation_strength_range( &mut self, min: Option<f64>, max: Option<f64>, ) -> &mut Self
Add consolidation strength range filter
Sourcepub fn add_recall_probability_range(
&mut self,
min: Option<f64>,
max: Option<f64>,
) -> &mut Self
pub fn add_recall_probability_range( &mut self, min: Option<f64>, max: Option<f64>, ) -> &mut Self
Add recall probability range filter
Sourcepub fn add_exclude_frozen(&mut self, exclude: bool) -> &mut Self
pub fn add_exclude_frozen(&mut self, exclude: bool) -> &mut Self
Add condition to exclude frozen tier if needed
Sourcepub fn add_last_access_interval(&mut self, hours: f64) -> &mut Self
pub fn add_last_access_interval(&mut self, hours: f64) -> &mut Self
Add a safe time interval condition for last access
Sourcepub fn add_recall_threshold_condition(&mut self, threshold: f64) -> &mut Self
pub fn add_recall_threshold_condition(&mut self, threshold: f64) -> &mut Self
Add recall probability threshold condition
Sourcepub fn add_pagination(
&mut self,
limit: usize,
offset: usize,
) -> Result<&mut Self>
pub fn add_pagination( &mut self, limit: usize, offset: usize, ) -> Result<&mut Self>
Add a limit and offset with validation
Sourcepub fn build_query(&self) -> String
pub fn build_query(&self) -> String
Build the final query string
Sourcepub fn bind_parameters<'a>(
&'a self,
query: Query<'a, Postgres, PgArguments>,
) -> Query<'a, Postgres, PgArguments>
pub fn bind_parameters<'a>( &'a self, query: Query<'a, Postgres, PgArguments>, ) -> Query<'a, Postgres, PgArguments>
Apply parameters to a sqlx query
Sourcepub fn bind_parameters_as<'a, T>(
&'a self,
query: QueryAs<'a, Postgres, T, PgArguments>,
) -> QueryAs<'a, Postgres, T, PgArguments>
pub fn bind_parameters_as<'a, T>( &'a self, query: QueryAs<'a, Postgres, T, PgArguments>, ) -> QueryAs<'a, Postgres, T, PgArguments>
Apply parameters to a sqlx query_as
Trait Implementations§
Source§impl Clone for SafeQueryBuilder
impl Clone for SafeQueryBuilder
Source§fn clone(&self) -> SafeQueryBuilder
fn clone(&self) -> SafeQueryBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SafeQueryBuilder
impl RefUnwindSafe for SafeQueryBuilder
impl Send for SafeQueryBuilder
impl Sync for SafeQueryBuilder
impl Unpin for SafeQueryBuilder
impl UnwindSafe for SafeQueryBuilder
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more