Struct toql::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
) -> SqlBuilder<'a>
pub fn new(
root_mapper: &'a str,
table_mapper_registry: &'a TableMapperRegistry
) -> SqlBuilder<'a>
Create a new SQL Builder from a root mapper and the table mapper registry
sourcepub fn with_roles(self, roles: HashSet<String, RandomState>) -> SqlBuilder<'a>
pub fn with_roles(self, roles: HashSet<String, RandomState>) -> SqlBuilder<'a>
Use these roles with the builder.
sourcepub fn with_aux_params(
self,
aux_params: HashMap<String, SqlArg, RandomState>
) -> SqlBuilder<'a>
pub fn with_aux_params(
self,
aux_params: HashMap<String, SqlArg, RandomState>
) -> SqlBuilder<'a>
Use these auxiliary parameters with the builder.
sourcepub fn with_extra_join<T>(self, join: T) -> SqlBuilder<'a> where
T: Into<String>,
pub fn with_extra_join<T>(self, join: T) -> SqlBuilder<'a> where
T: Into<String>,
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), ToqlError>
pub fn merge_expr(
&self,
query_field_path: &str
) -> Result<(SqlExpr, SqlExpr), ToqlError>
sourcepub fn build_delete<M>(
&mut self,
query: &Query<M>
) -> Result<BuildResult, ToqlError>
pub fn build_delete<M>(
&mut self,
query: &Query<M>
) -> Result<BuildResult, ToqlError>
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, ToqlError>
sourcepub fn build_select<M>(
&mut self,
query_home_path: &str,
query: &Query<M>
) -> Result<BuildResult, ToqlError>
pub fn build_select<M>(
&mut self,
query_home_path: &str,
query: &Query<M>
) -> Result<BuildResult, ToqlError>
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, ToqlError>
pub fn build_count<M>(
&mut self,
query_root_path: &str,
query: &Query<M>,
count_selection_only: bool
) -> Result<BuildResult, ToqlError>
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, ToqlError>
pub fn joined_mapper_for_query_path(
&self,
query_path: &FieldPath<'_>
) -> Result<&TableMapper, ToqlError>
pub fn mapper_for_query_path(
&self,
query_path: &FieldPath<'_>
) -> Result<&TableMapper, ToqlError>
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