github.com/ethersphere/bee/v2@v2.2.0/pkg/storage/migration/steps_chain.go (about)

     1  // Copyright 2022 The Swarm Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package migration
     6  
     7  // NewStepsChain returns new StepFn which combines all supplied StepFn
     8  // into single StepFn.
     9  func NewStepsChain(steps ...StepFn) StepFn {
    10  	return func() error {
    11  		for _, stepFn := range steps {
    12  			if err := stepFn(); err != nil {
    13  				return err
    14  			}
    15  		}
    16  
    17  		return nil
    18  	}
    19  }