pub struct SqlGenerator { /* private fields */ }Expand description
SQL Generator
Implementations§
Source§impl SqlGenerator
impl SqlGenerator
Sourcepub fn new(schema: Arc<GraphQLSchema>) -> Self
pub fn new(schema: Arc<GraphQLSchema>) -> Self
Create a new SQL generator
Sourcepub fn with_quote_char(self, char: char) -> Self
pub fn with_quote_char(self, char: char) -> Self
Set the quote character for identifiers
Sourcepub fn with_param_style(self, style: ParamStyle) -> Self
pub fn with_param_style(self, style: ParamStyle) -> Self
Set the parameter style
Sourcepub fn generate(
&self,
plan: &QueryPlan,
) -> Result<Vec<SqlQuery>, SqlGeneratorError>
pub fn generate( &self, plan: &QueryPlan, ) -> Result<Vec<SqlQuery>, SqlGeneratorError>
Generate SQL from a query plan
Sourcepub fn generate_count(
&self,
table: &str,
filters: &[Filter],
) -> Result<SqlQuery, SqlGeneratorError>
pub fn generate_count( &self, table: &str, filters: &[Filter], ) -> Result<SqlQuery, SqlGeneratorError>
Generate a count query
Sourcepub fn generate_insert(
&self,
table: &str,
values: &HashMap<String, Value>,
) -> Result<SqlQuery, SqlGeneratorError>
pub fn generate_insert( &self, table: &str, values: &HashMap<String, Value>, ) -> Result<SqlQuery, SqlGeneratorError>
Generate an INSERT query
Sourcepub fn generate_update(
&self,
table: &str,
id: &Value,
values: &HashMap<String, Value>,
) -> Result<SqlQuery, SqlGeneratorError>
pub fn generate_update( &self, table: &str, id: &Value, values: &HashMap<String, Value>, ) -> Result<SqlQuery, SqlGeneratorError>
Generate an UPDATE query
Sourcepub fn generate_delete(
&self,
table: &str,
id: &Value,
) -> Result<SqlQuery, SqlGeneratorError>
pub fn generate_delete( &self, table: &str, id: &Value, ) -> Result<SqlQuery, SqlGeneratorError>
Generate a DELETE query
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SqlGenerator
impl RefUnwindSafe for SqlGenerator
impl Send for SqlGenerator
impl Sync for SqlGenerator
impl Unpin for SqlGenerator
impl UnsafeUnpin for SqlGenerator
impl UnwindSafe for SqlGenerator
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> 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