json

package
v0.0.0-...-b4871a6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package json converts Arrow IPC streams into JSON-serializable result structures that mirror the LinDB sql/execution/model.ResultSet wire format (schema with typed columns + row-oriented data).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnMetadata

type ColumnMetadata struct {
	Name     string `json:"name"`
	DataType string `json:"type"`
}

ColumnMetadata describes one column in a query result schema. DataType is the Arrow-derived type name (via pkg/arrow.DataTypeName), e.g. "string" for tag columns, "time_series" / "sum" / "min" for metric fields. The JSON tag "type" matches the LinDB wire format (spi/types.ColumnMetadata).

type ResultSet

type ResultSet struct {
	Schema *Schema `json:"schema,omitempty"`
	Rows   [][]any `json:"rows,omitempty"`
}

ResultSet is the query result returned by the LinDB datasource. It mirrors the structure of LinDB sql/execution/model.ResultSet.

func DecodeArrowToResultSet

func DecodeArrowToResultSet(data []byte) (*ResultSet, error)

DecodeArrowToResultSet reads an Arrow IPC stream from data and converts it into a ResultSet whose structure mirrors LinDB sql/execution/model.ResultSet (schema with typed columns + row-oriented data). Returns nil without error when data is empty.

func DecodeRecordToResultSet

func DecodeRecordToResultSet(rec arrow.RecordBatch) (*ResultSet, error)

DecodeRecordToResultSet converts a single arrow.RecordBatch directly into a ResultSet without any intermediate IPC serialization. Prefer this over DecodeArrowToResultSet when the RecordBatch is already in memory.

type Schema

type Schema struct {
	Columns []ColumnMetadata `json:"columns,omitempty"`
}

Schema describes the columns of a query result set.

type TimeRange

type TimeRange struct {
	Start int64 `json:"start"`
	End   int64 `json:"end"`
}

TimeRange represents a time range with start and end timestamps in milliseconds.

type TimeSeries

type TimeSeries struct {
	Values      []float64 `json:"values,omitempty"`
	TimeRange   TimeRange `json:"timeRange"`
	Interval    int64     `json:"interval,omitempty"`
	NumOfPoints int       `json:"numOfPoints,omitempty"`
}

TimeSeries represents time series data for one field in a result row. Its structure mirrors LinDB spi/types.TimeSeries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL