pub struct QueryBuilder<'a> { /* private fields */ }Implementations§
Source§impl<'a> QueryBuilder<'a>
impl<'a> QueryBuilder<'a>
pub fn new(pool: &'a AnyPool, table: &str) -> Self
pub fn where_(self, column: &str, value: impl Serialize) -> Self
pub fn where_op( self, column: &str, operator: &str, value: impl Serialize, ) -> Self
pub fn where_raw(self, sql: &str, binds: Vec<Value>) -> Self
pub fn where_in(self, column: &str, values: Vec<impl Serialize>) -> Self
pub fn pool(&self) -> &'a AnyPool
pub fn order_by(self, column: &str, direction: &str) -> Self
pub fn limit(self, limit: usize) -> Self
pub async fn first<T: DeserializeOwned>(&self) -> Result<Option<T>, Error>
pub async fn get<T: DeserializeOwned>(&self) -> Result<Vec<T>, Error>
pub async fn count(&self) -> Result<i64, Error>
pub async fn insert(&self, data: Value) -> Result<(), Error>
pub async fn insert_get_id(&self, data: Value) -> Result<i64, Error>
pub async fn update(&self, data: Value) -> Result<u64, Error>
pub async fn delete(&self) -> Result<u64, Error>
Trait Implementations§
Source§impl<'a> Clone for QueryBuilder<'a>
impl<'a> Clone for QueryBuilder<'a>
Source§fn clone(&self) -> QueryBuilder<'a>
fn clone(&self) -> QueryBuilder<'a>
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 moreAuto Trait Implementations§
impl<'a> !RefUnwindSafe for QueryBuilder<'a>
impl<'a> !UnwindSafe for QueryBuilder<'a>
impl<'a> Freeze for QueryBuilder<'a>
impl<'a> Send for QueryBuilder<'a>
impl<'a> Sync for QueryBuilder<'a>
impl<'a> Unpin for QueryBuilder<'a>
impl<'a> UnsafeUnpin for QueryBuilder<'a>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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