v2

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package v2 holds framing information for the v2 REST API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RawToOneAPIErr added in v0.6.0

func RawToOneAPIErr(raw json.RawMessage, op errors.Op) error

RawToOneAPIErr returns a OneAPI error if it is buried where the "Row" should be. Otherwise it returns nil.

Types

type Base

type Base struct {
	FrameType string
}

Base is information that is encoded in all frames. The fields aren't actually in the spec, but are transmitted on the wire.

type DataSetCompletion

type DataSetCompletion struct {
	Base
	// HasErrors indicates that their was an error in the stream.
	HasErrors bool
	// Cancelled indicates that the request was cancelled.
	Cancelled bool
	// OneAPIErrors is a list of errors encountered.
	OneAPIErrors []string `json:"OneApiErrors"`

	Op errors.Op `json:"-"`
}

DataSetCompletion indicates the stream id done. It implements Frame.

func (DataSetCompletion) IsFrame

func (DataSetCompletion) IsFrame()

IsFrame implements frame.Frame.

func (*DataSetCompletion) UnmarshalRaw added in v0.2.0

func (d *DataSetCompletion) UnmarshalRaw(raw json.RawMessage) error

UnmarshalRaw unmarshals the raw JSON representing a DataSetCompletion.

type DataSetHeader

type DataSetHeader struct {
	Base
	// Version is the version of the APi responding. The current version is "v2.0".
	Version string
	// IsProgressive indicates that TableHeader, TableFragment, TableProgress, and TableCompletion
	IsProgressive bool

	Op errors.Op
}

DataSetHeader is the first frame in a response. It implements Frame.

func (DataSetHeader) IsFrame

func (DataSetHeader) IsFrame()

type DataTable

type DataTable struct {
	Base
	// TableID is a numeric representation of the this dataTable in relation to other dataTables returned
	// in numeric order starting at 09.
	TableID int `json:"TableId"`
	// TableKind is a Kusto dataTable sub-type.
	TableKind frames.TableKind
	// TableName is a name for the dataTable.
	TableName frames.TableKind
	// Columns is a list of column names and their Kusto storage types.
	Columns table.Columns
	// Rows contains the table data that was fetched, along with errors.
	Rows      []interface{}
	KustoRows []value.Values
	RowErrors []errors.Error

	Op errors.Op `json:"-"`
}

DataTable is used report information as a Table with Columns as row headers and Rows as the contained data. It implements Frame.

func (DataTable) IsFrame

func (DataTable) IsFrame()

IsFrame implements frame.Frame.

func (*DataTable) UnmarshalRaw added in v0.2.0

func (d *DataTable) UnmarshalRaw(raw json.RawMessage) error

UnmarshalRaw unmarshals the raw JSON representing a DataTable.

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder implements frames.Decoder on the REST v2 frames.

func (*Decoder) Decode

func (d *Decoder) Decode(ctx context.Context, r io.ReadCloser, op errors.Op) chan frames.Frame

Decode implements frames.Decoder.Decode(). This is not thread safe.

type TableCompletion

type TableCompletion struct {
	Base
	// TableID is a numeric representation of the this table in relation to other table parts returned.
	TableID int `json:"TableId"`
	// RowCount is the final number of rows in the table.
	RowCount int

	Op errors.Op `json:"-"`
}

TableCompletion frames marks the end of the table transmission. No more frames related to that table will be sent.

func (TableCompletion) IsFrame

func (TableCompletion) IsFrame()

IsFrame implements frame.Frame.

func (*TableCompletion) UnmarshalRaw added in v0.2.0

func (t *TableCompletion) UnmarshalRaw(raw json.RawMessage) error

UnmarshalRaw unmarshals the raw JSON representing a TableCompletion.

type TableFragment

type TableFragment struct {
	Base
	// TableID is a numeric representation of the this table in relation to other table parts returned.
	TableID int `json:"TableId"`
	// FieldCount is the number of  fields being returned. This should align with the len(TableHeader.Columns).
	FieldCount int
	// TableFragment type is the type of TFDataAppend or TFDataReplace.
	TableFragmentType string
	// Rows contains the the table data th[at was fetched.
	Rows      []interface{}
	KustoRows []value.Values
	RowErrors []errors.Error

	Columns table.Columns `json:"-"` // Needed for decoding values.

	Op errors.Op `json:"-"`
}

TableFragment details the streaming data passed by server that would normally be the Row data in

func (TableFragment) IsFrame

func (TableFragment) IsFrame()

IsFrame implements frame.Frame.

func (*TableFragment) UnmarshalRaw added in v0.2.0

func (t *TableFragment) UnmarshalRaw(raw json.RawMessage) error

UnmarshalRaw unmarshals the raw JSON representing a TableFragment.

type TableHeader

type TableHeader struct {
	Base
	// TableID is a numeric representation of the this TableHeader in the stream.
	TableID int `json:"TableId"`
	// TableKind is a Kusto Table sub-type.
	TableKind frames.TableKind
	// TableName is a name for the Table.
	TableName frames.TableKind
	// Columns is a list of column names and their Kusto storage types.
	Columns table.Columns

	Op errors.Op `json:"-"`
}

TableHeader indicates that instead of receiving a dataTable, we will receive a stream of table information. This structure holds the base information, but none of the row information.

func (TableHeader) IsFrame

func (TableHeader) IsFrame()

IsFrame implements frame.Frame.

func (*TableHeader) UnmarshalRaw added in v0.2.0

func (t *TableHeader) UnmarshalRaw(raw json.RawMessage) error

UnmarshalRaw unmarshals the raw JSON representing a TableHeader.

type TableProgress

type TableProgress struct {
	Base
	// TableID is a numeric representation of the this table in relation to other table parts returned.
	TableID int `json:"TableId"`
	// TableProgress is the progress in percent (0--100).
	TableProgress float64

	Op errors.Op `json:"-"`
}

TableProgress interleaves with the TableFragment frame described above. It's sole purpose is to notify the client about the query progress.

func (TableProgress) IsFrame

func (TableProgress) IsFrame()

IsFrame implements frame.Frame.

func (*TableProgress) UnmarshalRaw added in v0.2.0

func (t *TableProgress) UnmarshalRaw(raw json.RawMessage) error

UnmarshalRaw unmarshals the raw JSON representing a TableProgress.

Jump to

Keyboard shortcuts

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