controlflow

package
v1.76.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: MIT Imports: 3 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 Checkerr2Exit added in v1.55.0

func Checkerr2Exit(tag string, err error)

func Checkerr2Raise added in v1.55.0

func Checkerr2Raise(tag string, err error)

The equivalent of !!! operator in Go2

func Either added in v1.46.0

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

func Raise1 added in v1.56.0

func Raise1(x any)

You should not use Raise1() to re-raise exceptions - use Raise2() instead. This one is intended only for cases where you create a new exception.

func Raise2 added in v1.53.0

func Raise2(added_context any, x any)

Types

type Exception

type Exception struct {
	X             interface{}
	TheCauseError error
	AttemptNb     int
	XChain        []any
}

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) Error added in v1.60.0

func (e *Exception) Error() string

func (*Exception) OK added in v1.51.0

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

func (*Exception) String added in v1.53.0

func (e *Exception) String() string

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()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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