gitlab.com/evatix-go/core@v1.3.55/conditional/ErrorFunctionResult.go (about)

     1  package conditional
     2  
     3  // ErrorFunctionResult execute error function based on condition and returns final error
     4  func ErrorFunctionResult(
     5  	isTrue bool,
     6  	trueValueFunction func() error,
     7  	falseValueFunction func() error,
     8  ) error {
     9  	if isTrue {
    10  		return trueValueFunction()
    11  	}
    12  
    13  	return falseValueFunction()
    14  }