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 or other request-scoped values.
closurefunc(context.Context) (interface{}, error)The function to be executed asynchronously. It takes a context and returns an interface{} and an error.

Returns

TypeDescription
*AsyncFutureA pointer to an AsyncFuture object which will eventually hold the result of the closure's execution.