Aller au contenu

Missing Bulk Operation (ARCH5053)

Ce contenu n’est pas encore disponible dans votre langue.

Key go.orm.missing-bulk-operation · Severity warning · Category orm

Inserting rows one at a time in a loop when a bulk API like CreateInBatches exists wastes round-trips. Collapse to a single bulk call.

for _, p := range products {
db.Create(&p)
}
db.CreateInBatches(products, 200)

Merge per-iteration insert/update calls into a bulk API such as CreateInBatches.