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

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