controlflow

package
v1.51.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All added in v1.46.0

func All(ops ...func() bool) (r bool)

func Checkerr added in v1.46.0

func Checkerr(err error)

func Checkerr2 added in v1.50.0

func Checkerr2(tag string, err error)

func Either added in v1.46.0

func Either(ops ...func() bool) (r bool)

Types

type Exception

type Exception struct {
	AttemptNb int
	X         interface{}
	Err       error
}

func Retry added in v1.51.0

func Retry(f func() (err error), f2 func(e *Exception) (end bool)) (e *Exception)

Allows to try and retry an operation several times.

func Try

func Try(f func() (err error)) (e *Exception)

func (*Exception) Catch

func (e *Exception) Catch(f func(e *Exception)) *Exception

func (*Exception) OK added in v1.51.0

func (e *Exception) OK(f func(e *Exception)) *Exception

type KeyedTable

type KeyedTable[T comparable] map[T]func() int // -1 break/complete

func (KeyedTable[T]) Sequence

func (t KeyedTable[T]) Sequence(keys ...T)

func (KeyedTable[T]) Switch

func (t KeyedTable[T]) Switch(primary, default_ T)

type MatchCase

type MatchCase struct {
	Match func() int // 0 no match, 1 match, -1 break
	Then  func() int
}

type MatchTable

type MatchTable []MatchCase

func (MatchTable) Match

func (t MatchTable) Match()

Jump to

Keyboard shortcuts

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