---
title: "Collect"
description: "Convert any sequence into a slice."
image: "https://tilebox.com/images/tilebox-docs-social-preview.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://tilebox.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Collect

import { Fragment } from "astro/jsx-runtime";

import ApiReference from "@docs/components/ApiReference.astro";

import ParamField from "@docs/components/ParamField.astro";

```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**

type: iter.Seq2[K, error]

The sequence to convert.

## Returns

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

<h2 id="request-example">Usage example</h2>

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

Source: https://tilebox.com/docs/api-reference/go/workflows/Collect/index.mdx
