// BatchUpdateTx updates records of a batch entities in the database.
BatchUpdateTx updates records of a batch entities in the database.
// BatchUpdateTx updates records of a batch entities in the database .
func (r MigrationRepository) BatchUpdateTx(ctx context.Context, t migration.Transaction, list migration.LogsList) error {
	tx, ok := t.(*sqlx.Tx)
	if !ok {
		return errors.New("can not assert param t migration.Transaction to *sqlx.Tx")
	}
	ids := list.IDs()
	sort.Ints(ids)
	for _, i := range ids {
		id := uint(i)
		item := list[id]
		err := r.update(ctx, tx, &item)
		if err != nil {
			return errors.Wrapf(apperror.ErrInternal, "error while updating log of migration #%v", id)
		}
		list[id] = item
	}
	return nil
}
func ( r MigrationRepository ) BatchUpdateTx ( ctx context . Context , t migration . Transaction , list migration . LogsList ) error { tx , ok := t . ( * sqlx . Tx ) if ! ok { return errors . New ( " " ) } ids := list . IDs ( ) sort . Ints ( ids ) for _ , i := range ids { id := uint ( i ) item := list [ id ] err := r . update ( ctx , tx , & item ) if err != nil { return errors . Wrapf ( apperror . ErrInternal , " " , id ) } list [ id ] = item } return nil }
BatchUpdateTx updates records of a batch entities in the database.
BatchUpdateTx updates records of a batch entities in the database .