v2

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package v2 holds framing information for the v2 REST API.

Index

Constants

View Source
const (
	TFDataAppend  = "DataAppend"
	TFDataReplace = "DataReplace"
)

Variables

This section is empty.

Functions

This section is empty.

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()

func (*DataSetCompletion) Unmarshal

func (d *DataSetCompletion) Unmarshal(m map[string]interface{}) (err error)

Unmarshal unmarshals a JSON decoded map value that represents 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 the table data that was fetched.
	Rows []value.Values

	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()

func (*DataTable) Unmarshal

func (d *DataTable) Unmarshal(m map[string]interface{}) error

Unmarshal unmarshals a JSON decoded map value that represents a dataTable.

type Decoder

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

Decoder impolements 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()

func (*TableCompletion) Unmarshal

func (t *TableCompletion) Unmarshal(m map[string]interface{}) (err error)

Unmarshal unmarshals a JSON decoded map value that represents 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 that was fetched.
	Rows []value.Values

	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()

func (*TableFragment) Unmarshal

func (t *TableFragment) Unmarshal(m map[string]interface{}) (err error)

Unmarshal unmarshals a JSON decoded map value that represents 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()

func (*TableHeader) Unmarshal

func (t *TableHeader) Unmarshal(m map[string]interface{}) (err error)

Unmarshal unmarshals a JSON decoded map value that represents 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()

func (*TableProgress) Unmarshal

func (t *TableProgress) Unmarshal(m map[string]interface{}) (err error)

Unmarshal unmarshals a JSON decoded map value that represents a TableProgress.

Jump to

Keyboard shortcuts

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