func MaxRetiesOpt(retryCount int) OptionFactory {
	return func() Option {
		return &maxRetiesOpt{
			retryCount: retryCount,
		}
	}
}
MaxRetiesOpt returns a retry option factory
package retry
import (
	"time"
)
type Option interface {
	Init()
	CanRetry() bool
}
type OptionFactory func() Option
type Func func(execFunc) error
type execFunc func() error
func New(r OptionFactory) Func {
	return func(fun execFunc) error {
		var firstErr error
		opt := r()
		opt.Init()
		for {
			err := fun()
			if err == nil {
				return nil
			}
			if firstErr == nil {
				firstErr = err
			}
			if !opt.CanRetry() {
				return firstErr
			}
		}
	}
}