Struct toql_core::sql_builder::SqlBuilder
source · [−]pub struct SqlBuilder<'a> { /* private fields */ }
Expand description
The Sql builder to build normal queries and count queries.
Implementations
sourceimpl<'a> SqlBuilder<'a>
impl<'a> SqlBuilder<'a>
sourcepub fn new(
root_mapper: &'a str,
table_mapper_registry: &'a TableMapperRegistry
) -> Self
pub fn new(
root_mapper: &'a str,
table_mapper_registry: &'a TableMapperRegistry
) -> Self
Create a new SQL Builder from a root mapper and the table mapper registry
sourcepub fn with_roles(self, roles: HashSet<String>) -> Self
pub fn with_roles(self, roles: HashSet<String>) -> Self
Use these roles with the builder.
sourcepub fn with_aux_params(self, aux_params: HashMap<String, SqlArg>) -> Self
pub fn with_aux_params(self, aux_params: HashMap<String, SqlArg>) -> Self
Use these auxiliary parameters with the builder.
sourcepub fn with_extra_join<T: Into<String>>(self, join: T) -> Self
pub fn with_extra_join<T: Into<String>>(self, join: T) -> Self
Add this raw SQL join statement to the result. (For internal merge joins)
pub fn columns_expr(
&self,
query_field_path: &str,
alias: &str
) -> Result<(SqlExpr, SqlExpr)>
pub fn merge_expr(&self, query_field_path: &str) -> Result<(SqlExpr, SqlExpr)>
sourcepub fn build_delete<M>(&mut self, query: &Query<M>) -> Result<BuildResult>
pub fn build_delete<M>(&mut self, query: &Query<M>) -> Result<BuildResult>
Build a delete statement from the Query. This build a delete filter predicate from the field filters and predicates in the query. Any field selections are ignored.
Returns a BuildResult that can be turned into SQL.
pub fn build_merge_delete(
&mut self,
merge_path: &FieldPath<'_>,
key_predicate: SqlExpr
) -> Result<SqlExpr>
sourcepub fn build_select<M>(
&mut self,
query_home_path: &str,
query: &Query<M>
) -> Result<BuildResult>
pub fn build_select<M>(
&mut self,
query_home_path: &str,
query: &Query<M>
) -> Result<BuildResult>
Build a normal select statement from the Query.
Returns a BuildResult that can be turned into SQL.
sourcepub fn build_count<M>(
&mut self,
query_root_path: &str,
query: &Query<M>,
count_selection_only: bool
) -> Result<BuildResult>
pub fn build_count<M>(
&mut self,
query_root_path: &str,
query: &Query<M>,
count_selection_only: bool
) -> Result<BuildResult>
Build a count statement from the Query.
This build a count filter predicate from the field filters and predicates.
If count_selection_ony
is true then only filters are used that are part
of the count selection ($cnt) or predicates that are marked as count_filters.
Returns a BuildResult that can be turned into SQL.
pub fn joined_mapper_for_local_path(
&self,
local_path: &FieldPath<'_>
) -> Result<&TableMapper>
pub fn joined_mapper_for_query_path(
&self,
query_path: &FieldPath<'_>
) -> Result<&TableMapper>
pub fn mapper_for_query_path(
&self,
query_path: &FieldPath<'_>
) -> Result<&TableMapper>
Auto Trait Implementations
impl<'a> !RefUnwindSafe for SqlBuilder<'a>
impl<'a> Send for SqlBuilder<'a>
impl<'a> Sync for SqlBuilder<'a>
impl<'a> Unpin for SqlBuilder<'a>
impl<'a> !UnwindSafe for SqlBuilder<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more