pub struct FactoryBuilder<F: Factory> { /* private fields */ }Expand description
A pending set of rows.
Implementations§
Source§impl<F: Factory> FactoryBuilder<F>
impl<F: Factory> FactoryBuilder<F>
pub fn new() -> Self
Sourcepub fn state(self, state: impl Fn(&mut F::Active) + Send + 'static) -> Self
pub fn state(self, state: impl Fn(&mut F::Active) + Send + 'static) -> Self
Override part of the definition.
The closure receives each row in turn, so a count(3) with a state that
varies by call produces three different rows.
Sourcepub async fn create(
&self,
) -> Result<Vec<<<<F as Factory>::Active as ActiveModelTrait>::Entity as EntityTrait>::Model>>where
<<<F as Factory>::Active as ActiveModelTrait>::Entity as EntityTrait>::Model: IntoActiveModel<F::Active> + Hooks<Active = F::Active>,
pub async fn create(
&self,
) -> Result<Vec<<<<F as Factory>::Active as ActiveModelTrait>::Entity as EntityTrait>::Model>>where
<<<F as Factory>::Active as ActiveModelTrait>::Entity as EntityTrait>::Model: IntoActiveModel<F::Active> + Hooks<Active = F::Active>,
Insert the rows, running the model’s hooks.
Sourcepub async fn create_one(
&self,
) -> Result<<<<F as Factory>::Active as ActiveModelTrait>::Entity as EntityTrait>::Model>where
<<<F as Factory>::Active as ActiveModelTrait>::Entity as EntityTrait>::Model: IntoActiveModel<F::Active> + Hooks<Active = F::Active>,
pub async fn create_one(
&self,
) -> Result<<<<F as Factory>::Active as ActiveModelTrait>::Entity as EntityTrait>::Model>where
<<<F as Factory>::Active as ActiveModelTrait>::Entity as EntityTrait>::Model: IntoActiveModel<F::Active> + Hooks<Active = F::Active>,
Insert exactly one row and return it, regardless of count.
Trait Implementations§
Auto Trait Implementations§
impl<F> !RefUnwindSafe for FactoryBuilder<F>
impl<F> !Sync for FactoryBuilder<F>
impl<F> !UnwindSafe for FactoryBuilder<F>
impl<F> Freeze for FactoryBuilder<F>
impl<F> Send for FactoryBuilder<F>
impl<F> Unpin for FactoryBuilder<F>
impl<F> UnsafeUnpin for FactoryBuilder<F>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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