Skip to main content

NewAsyncFuture

Creates a new Async future, that will call the method closure and return the results from the execution of this method

def NewAsyncFuture(
ctx: context.Context,
closure: func(context.Context) (interface{}, error)
) - > *AsyncFuture

Creates a new Async future, that will call the method closure and return the results from the execution of this method

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the asynchronous operation, allowing for cancellation and propagation of deadlines.
closurefunc(context.Context) (interface{}, error)The function to be executed asynchronously. It takes a context and returns a result and an error.

Returns

TypeDescription
*AsyncFutureA new AsyncFuture object that will execute the provided closure asynchronously.