pub struct RenderCtx { /* private fields */ }Expand description
Rendering context: accumulates SQL string and parameters.
Provides a semantic, chainable API for building SQL output.
Implementations§
Source§impl RenderCtx
impl RenderCtx
pub fn new(param_style: ParamStyle) -> Self
pub fn with_parameterize(self, parameterize: bool) -> Self
Sourcepub fn parameterize(&self) -> bool
pub fn parameterize(&self) -> bool
Whether values should be rendered as parameter placeholders.
Sourcepub fn finish(self) -> (String, Vec<Value>)
pub fn finish(self) -> (String, Vec<Value>)
Consume the context and return the SQL string and parameters.
Sourcepub fn keyword(&mut self, kw: &str) -> &mut Self
pub fn keyword(&mut self, kw: &str) -> &mut Self
Write a SQL keyword. Adds a leading space if the buffer is non-empty
and doesn’t end with ( or whitespace.
Sourcepub fn param(&mut self, val: Value) -> &mut Self
pub fn param(&mut self, val: Value) -> &mut Self
Write a parameterized value. Appends the placeholder ($1, ?, etc.) and stores the value.
Sourcepub fn string_literal(&mut self, s: &str) -> &mut Self
pub fn string_literal(&mut self, s: &str) -> &mut Self
Write a string literal with proper escaping: 'value'.
Sourcepub fn paren_open(&mut self) -> &mut Self
pub fn paren_open(&mut self) -> &mut Self
Write opening parenthesis (, with space if needed.
Sourcepub fn paren_close(&mut self) -> &mut Self
pub fn paren_close(&mut self) -> &mut Self
Write closing parenthesis ).
Auto Trait Implementations§
impl Freeze for RenderCtx
impl RefUnwindSafe for RenderCtx
impl Send for RenderCtx
impl Sync for RenderCtx
impl Unpin for RenderCtx
impl UnsafeUnpin for RenderCtx
impl UnwindSafe for RenderCtx
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