future

package module
v0.0.0-...-e40d1ef Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

type Chain []Future

Chain executes futures sequentially, breaking on the first error.

func (*Chain) Await

func (c *Chain) Await(ctx context.Context) error

type Future

type Future interface {
	// Await waits for the future to complete and returns the result.
	Await(context.Context) error
}

Future represents a deferred function call. Wrapped function starts on Await.

func WrapFunc

func WrapFunc(f func(context.Context) error) Future

WrapFunc wraps the function call in a future. Await returns the resulting error.

func WrapVoidFunc

func WrapVoidFunc(f func(context.Context)) Future

WrapVoidFunc wraps the function call in a future. Await returns either nil or context.Cancelled.

type Group

type Group []Future

Group executes futures concurrently, breaking on the first error.

func (*Group) Await

func (g *Group) Await(ctx context.Context) error

type Mock

type Mock struct {
	mock.Mock
}

Mock is an autogenerated mock type for the Future type

func NewMock

func NewMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *Mock

NewMock creates a new instance of Mock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*Mock) Await

func (_m *Mock) Await(_a0 context.Context) error

Await provides a mock function with given fields: _a0

Jump to

Keyboard shortcuts

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