Skip to content

Instance Method

flatten(_:)

Returns a new EventLoopFuture that succeeds only when all the provided futures succeed. The new EventLoopFuture contains an array of results, maintaining same ordering as the futures.
func flatten<T>(_ futures: [EventLoopFuture<T>]) -> EventLoopFuture<[T]>

Parameters

futures

An array of futures to flatten into a single EventLoopFuture.

Return Value

A new EventLoopFuture with all the resolved values of the input collection.

Discussion

The returned EventLoopFuture will fail if any of the provided futures fails. All remaining EventLoopFuture objects will be ignored.

See Also

EventLoop and EventLoopGroup