Skip to main content
func (datasetClient) Create(
    ctx context.Context,
    name string,
    kind datasets.DatasetKind,
    codeName string, 
    description string,
    fields []Field,
) (*datasets.Dataset, error)
Create a dataset.

Parameters

name
string
The name of the dataset
kind
datasets.DatasetKind
The kind of the dataset
codeName
string
The code name of the dataset
description
string
The description of the dataset
fields
[]Field
The fields of the dataset

Dataset kinds

KindTemporal
datasets.DatasetKind
A dataset that contains a timestamp field
KindSpatiotemporal
datasets.DatasetKind
A dataset that contains a timestamp field and a geometry field

Field types

field.String(name string)
Field
A string field
field.Bytes(name string)
Field
A bytes field
field.Bool(name string)
Field
A boolean field
field.Int64(name string)
Field
A 64-bit signed integer field
field.Uint64(name string)
Field
A 64-bit unsigned integer field
field.Float64(name string)
Field
A 64-bit floating-point number field
field.Duration(name string)
Field
A duration field
field.Timestamp(name string)
Field
A timestamp field
field.UUID(name string)
Field
A UUID field
field.Geometry(name string)
Field
A geometry field

Field options

Repeated()
Indicate that the field is an array
Description(description string)
Set the description of the field to provide more context and details about the data
ExampleValue(exampleValue string)
Set the example value of the field for documentation purposes

Returns

The created dataset object.
dataset, err := client.Datasets.Create(ctx,
    "My personal catalog",
    datasets.KindSpatiotemporal,
    "my_catalog",
    "A description of my catalog",
    []Field{
        field.String("field1"),
        field.Int64("field2").Repeated(),
        field.Geometry("field3").Description("Field 3").ExampleValue("Value 3"),
    },
)