# Collect

```go
func Collect[K any](seq iter.Seq2[K, error]) ([]K, error)
```

Convert any sequence into a slice.

It returns an error if any element in the sequence has a non-nil error.

## Parameters

**seq**

`iter.Seq2[K, error]`

The sequence to convert.

## Returns

A slice of `K` or an error if any.

```go title="Go"
jobs, err := workflows.Collect(
  client.Jobs.Query(ctx, job.WithTemporalExtent(interval)),
)
```
