Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Do ¶
func Do[T any](cb CircuitBreaker, cmd string, onHandle Handler, onError ErrorHandler) (*T, error)
Do is a helper function that wraps the CircuitBreaker.Do method and returns the result as the expected type.
Types ¶
type CircuitBreaker ¶
type CircuitBreaker interface {
Do(cmd string, onHandle Handler, onError ErrorHandler) (any, error)
}
func NewGoBreaker ¶
NewGoBreaker creates a new circuit breaker instance that is using go-breaker as the implementation and the LRU cache for the storage. For each command, it will create a new circuit breaker instance and store it in the LRU cache. That means, if the command is not used for a while, it will be removed from the cache to free up the memory.
type ErrorHandler ¶
Click to show internal directories.
Click to hide internal directories.