Skip to content

DatapointDecoder.Unmarshal

go
func (d datasets.DatapointDecoder) Unmarshal(
    descriptor *datasets.DatapointDescriptor,
    data []byte,
) (map[string]any, error)

Decode a raw protobuf datapoint into a JSON-like map with configurable protobuf decoding options.

Parameters

descriptor *datasets.DatapointDescriptor required

The descriptor returned by NewDatapointDescriptor.

data []byte required

The raw protobuf datapoint bytes returned by a datapoint query.

Decoder options

AllowPartial bool

Allow messages that are missing required fields.

DiscardUnknown bool

Ignore unknown fields in the raw protobuf message.

Resolver

Override the resolver used to look up message and extension types.

RecursionLimit int

Limit how deeply nested messages may be decoded. A zero value uses the protobuf default.

Returns

A map of datapoint fields, or an error if the raw datapoint cannot be decoded.

Custom enums return the strings from your schema, just as with UnmarshalDatapoint: a string for a scalar field, or a []any of strings for a repeated field. Unset fields are left out; zero or unknown custom enum numbers return an error.

Type to search…