GORM Playground Link

https://github.com/go-gorm/playground/pull/429

Description

batch update using where id in (...) in for loop, one loop will executes twice, and second one will chain other conditions

for start < idsLen {
    end := start + 100
    if end > idsLen {
        end = idsLen
    }
    err := db.Model(&Author{}).Where("user_id in (?)", ids[start:end]).Update("status", status).Error
    start = end
}

got 1. UPDATE author SET status=5 WHERE user_id in (1,2,3) 2. UPDATE author SET status=5 WHERE user_id in (1,2,3) and user_id in (4)