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

# Collect

```go theme={"system"}
func Collect[K any](seq iter.Seq2[K, error]) ([]K, error)
```

Convert any sequence into a slice.

It return an error if any of the elements in the sequence has a non-nil error.

## Parameters

<ParamField path="seq" type="iter.Seq2[[]K, error]">
  The sequence of bytes to convert
</ParamField>

## Returns

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

<RequestExample>
  ```go Go theme={"system"}
  import (
    "time"
    datasets "github.com/tilebox/tilebox-go/datasets/v1"
  	"github.com/tilebox/tilebox-go/query"
  )

  startDate := time.Date(2014, 10, 4, 0, 0, 0, 0, time.UTC) 
  endDate := time.Date(2021, 2, 24, 0, 0, 0, 0, time.UTC) 
  queryInterval := query.NewTimeInterval(startDate, endDate)

  datapoints, err := datasets.Collect(datasets.As[*v1.Sentinel1Sar](
      client.Datapoints.Query(
        ctx,
        datasetID,
        datasets.WithCollectionIDs(collectionID),
        datasets.WithTemporalExtent(queryInterval),
      ),
  ))
  ```
</RequestExample>
