pub async fn insert_many<E>(
_pool: &PgPool,
entities: &[E],
options: Option<BatchOptions>,
) -> BatchResult<BatchResultInfo>Expand description
Insert multiple entities in batches
This function inserts multiple entities in batches for better performance and to avoid statement size limits.
§Arguments
pool- The database connection poolentities- The entities to insertoptions- Optional batch operation settings
§Returns
Information about the batch operation
§Example
use ormkit::batch::insert_many;
let users = vec![/* ... */];
let result = insert_many(&pool, &users, None).await?;
println!("Inserted {} users", result.successful);