Documentation ¶
Index ¶
Constants ¶
View Source
const ( ErrorTimeout = "timeout" ErrorContext = "context" )
Variables ¶
View Source
var Separator = "!"
Separator is used to separate sub-keys for hierarchical settings.
Functions ¶
func Go ¶
func Go[T any]( ctx context.Context, name string, primary func(context.Context) (T, error), fallback func(context.Context) (T, error), ) (T, bool, error)
Go calls your primary function, and if that fails calls your fallback function if provided.
Returns the output of the primary or fallback, along with true if the result was from the primary function, or false if it was from the fallback function or the library itself.
func SetDefaultSettings ¶
func SetDefaultSettings(s Settings)
Types ¶
type Circuit ¶
type Circuit struct {
// contains filtered or unexported fields
}
func GetCircuit ¶
func NewCircuit ¶
type Error ¶
type Settings ¶
type Settings struct { Timeout *printable.Duration `json:"timeout"` PrimaryTimeout *printable.Duration `json:"primary_timeout"` FallbackTimeout *printable.Duration `json:"fallback_timeout"` BreakPercent *float32 `json:"break_percent"` }
Everything is a nil-pointer to allow optional settings.
func GetDefaultSettings ¶
func GetDefaultSettings() Settings
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
func (Tree) GetSettings ¶
func (n Tree) GetSettings() Settings
Source Files ¶
Click to show internal directories.
Click to hide internal directories.