fallback

package
v0.0.0-...-d356a15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithUseFallback

func WithUseFallback(useFallback func(err error) bool) option

WithUseFallback sets those errors that should trigger a fallback.

Types

type Fallback

type Fallback struct {
	// contains filtered or unexported fields
}

func New

func New(call FallbackFn, opts ...option) *Fallback

New creates a new Fallback with the supplied options.

func (*Fallback) Call

func (f *Fallback) Call() error

Call will execute the fallback function. Callers should check UseFallback prior to calling.

func (*Fallback) UseFallback

func (f *Fallback) UseFallback(err error) bool

UseFallback will indicate if the fallback should be called.

type FallbackFn

type FallbackFn func() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL