pub struct CreateManyOperation<E: QueryEngine, M: Model> { /* private fields */ }Expand description
Create many records at once.
Implementations§
Source§impl<E: QueryEngine, M: Model> CreateManyOperation<E, M>
impl<E: QueryEngine, M: Model> CreateManyOperation<E, M>
Sourcepub fn columns(
self,
columns: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn columns( self, columns: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Set the columns for insertion.
Sourcepub fn row(
self,
values: impl IntoIterator<Item = impl Into<FilterValue>>,
) -> Self
pub fn row( self, values: impl IntoIterator<Item = impl Into<FilterValue>>, ) -> Self
Add a row of values.
Sourcepub fn rows(
self,
rows: impl IntoIterator<Item = impl IntoIterator<Item = impl Into<FilterValue>>>,
) -> Self
pub fn rows( self, rows: impl IntoIterator<Item = impl IntoIterator<Item = impl Into<FilterValue>>>, ) -> Self
Add multiple rows.
Sourcepub fn skip_duplicates(self) -> Self
pub fn skip_duplicates(self) -> Self
Skip records that violate unique constraints.
Sourcepub fn with_skip_duplicates(self, flag: bool) -> Self
pub fn with_skip_duplicates(self, flag: bool) -> Self
Toggle skip_duplicates via a runtime flag.
The bare Self::skip_duplicates is a builder-style “enable
it” call. The macros emit with_skip_duplicates(<bool-expr>)
so the DSL’s skip_duplicates: false shortcut produces a
statement-level no-op without conditional macro emission.
Sourcepub fn with_create_inputs<I, T>(self, inputs: I) -> Self
pub fn with_create_inputs<I, T>(self, inputs: I) -> Self
Apply a batch of typed CreateInputs.
Each input lowers to its own CreatePayload
(Vec<(column, value)>). The full set of columns across every
input becomes the operation’s column list (first occurrence
wins for ordering); rows missing a column get FilterValue::Null
in that slot. This matches Prisma’s createMany semantics,
where omitted optional fields are inserted as NULL.
Sourcepub fn build_sql(&self, dialect: &dyn SqlDialect) -> (String, Vec<FilterValue>)
pub fn build_sql(&self, dialect: &dyn SqlDialect) -> (String, Vec<FilterValue>)
Build the SQL query.
Sourcepub async fn exec(self) -> QueryResult<u64>
pub async fn exec(self) -> QueryResult<u64>
Execute the create operation and return the number of created records.