[−][src]Struct orma::DbJoin
This struct is used to create a join between DbEntyty elements and JoinBuilder is used to create a DbJoin instance.
sorting parameter (such as vec!["data->>'first_name'", "data->>'last_name' DESC"]) take effect after a call to fetch method.
items can be persisted to db after a call to save_items method.
See JoinBuilder for more info
Fields
offset: i64
The offset of the extracted query join
limit: i64
The limit of the extracted query join. If limit is negative it means "no limit"
sorting: Vec<String>
Used to provide a sorting method on data fetching.
vec!["data->>'first_name'", "data->>'last_name' DESC"];
Implementations
impl DbJoin
[src]
pub async fn fetch<'_, '_, A>(
&'_ self,
conn: &'_ Connection
) -> Result<Vec<DbEntity<A>>, DbError> where
A: DbData,
[src]
&'_ self,
conn: &'_ Connection
) -> Result<Vec<DbEntity<A>>, DbError> where
A: DbData,
This method fetches items field for the given join using the current sorting field.
pub async fn fetch_filtered<'_, '_, '_, '_, '_, A>(
&'_ self,
conn: &'_ Connection,
filter: (&'_ str, &'_ [&'_ (dyn ToSql + Sync)])
) -> Result<Vec<DbEntity<A>>, DbError> where
A: DbData,
[src]
&'_ self,
conn: &'_ Connection,
filter: (&'_ str, &'_ [&'_ (dyn ToSql + Sync)])
) -> Result<Vec<DbEntity<A>>, DbError> where
A: DbData,
This method fetches items field for the given join using the current sorting field.
Filter is a tuple with the query filter and its values.
The target table is aliased with "a" name so a query filter could be "a.data->>'name' LIKE $1"
pub async fn add_items<'_, '_, '_, A>(
&'_ self,
conn: &'_ mut Connection,
items: &'_ [DbEntity<A>]
) -> Result<(), DbError> where
A: DbData,
[src]
&'_ self,
conn: &'_ mut Connection,
items: &'_ [DbEntity<A>]
) -> Result<(), DbError> where
A: DbData,
This method adds items for the given join to the DB.
pub async fn add_items_by_id<'_, '_, '_, '_>(
&'_ self,
conn: &'_ mut Connection,
items: &'_ [&'_ Uuid]
) -> Result<(), DbError>
[src]
&'_ self,
conn: &'_ mut Connection,
items: &'_ [&'_ Uuid]
) -> Result<(), DbError>
This method adds items for the given join to the DB using object ids.
pub async fn remove_items<'_, '_, '_, A>(
&'_ self,
conn: &'_ mut Connection,
items: Option<&'_ [DbEntity<A>]>
) -> Result<(), DbError> where
A: DbData,
[src]
&'_ self,
conn: &'_ mut Connection,
items: Option<&'_ [DbEntity<A>]>
) -> Result<(), DbError> where
A: DbData,
This method removes items for the given join to the DB.
pub async fn remove_items_by_id<'_, '_, '_>(
&'_ self,
conn: &'_ mut Connection,
items_id: Option<&'_ [Uuid]>
) -> Result<(), DbError>
[src]
&'_ self,
conn: &'_ mut Connection,
items_id: Option<&'_ [Uuid]>
) -> Result<(), DbError>
This method removes items for the given join to the DB using object ids.
Auto Trait Implementations
impl RefUnwindSafe for DbJoin
impl Send for DbJoin
impl Sync for DbJoin
impl Unpin for DbJoin
impl UnwindSafe for DbJoin
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,