pub struct UpdateBuilder { /* private fields */ }Expand description
Fluent builder for UPDATE queries.
§Example
use oxisql_core::query::UpdateBuilder;
let q = UpdateBuilder::new()
.table("users")
.set("email", &"new@example.com")
.where_eq("id", &42i64)
.build();
assert_eq!(q.sql, "UPDATE users SET email = $1 WHERE id = $2");Implementations§
Source§impl UpdateBuilder
impl UpdateBuilder
Sourcepub fn set(self, col: &str, val: &dyn ToSqlValue) -> Self
pub fn set(self, col: &str, val: &dyn ToSqlValue) -> Self
Add a SET col = $N assignment, binding the value.
Sourcepub fn where_raw(self, cond: &str) -> Self
pub fn where_raw(self, cond: &str) -> Self
Add a raw WHERE condition. Call multiple times to AND them.
Sourcepub fn where_eq(self, col: &str, val: &dyn ToSqlValue) -> Self
pub fn where_eq(self, col: &str, val: &dyn ToSqlValue) -> Self
Add a WHERE col = $N condition, binding the value.
Sourcepub fn build(self) -> BuiltQuery
pub fn build(self) -> BuiltQuery
Build the query into a BuiltQuery.
Trait Implementations§
Source§impl Clone for UpdateBuilder
impl Clone for UpdateBuilder
Source§fn clone(&self) -> UpdateBuilder
fn clone(&self) -> UpdateBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UpdateBuilder
impl Debug for UpdateBuilder
Source§impl Default for UpdateBuilder
impl Default for UpdateBuilder
Source§fn default() -> UpdateBuilder
fn default() -> UpdateBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for UpdateBuilder
impl RefUnwindSafe for UpdateBuilder
impl Send for UpdateBuilder
impl Sync for UpdateBuilder
impl Unpin for UpdateBuilder
impl UnsafeUnpin for UpdateBuilder
impl UnwindSafe for UpdateBuilder
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