Documentation
¶
Index ¶
- func ToStructs[T any](data interface{}) ([]T, error)
- func ToStructsIterative[T any](tb IterativeTable) chan StructResult[T]
- type BaseDataset
- type BaseTable
- type Column
- type Columns
- type Dataset
- type IterativeDataset
- type IterativeTable
- type Row
- type RowResult
- type StructResult
- type Table
- type TableResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToStructs ¶
ToStructs converts a table, a non-iterative dataset or a slice of rows into a slice of structs. If a dataset is provided, it should contain exactly one table.
func ToStructsIterative ¶
func ToStructsIterative[T any](tb IterativeTable) chan StructResult[T]
Types ¶
type BaseDataset ¶
BaseDataset represents a result from kusto - a set of tables with metadata This basic interface is implemented by all dataset types - both v1 and v2 for specific
func NewBaseDataset ¶
type BaseTable ¶
type BaseTable interface { Id() string Index() int64 Name() string Columns() []Column Kind() string ColumnByName(name string) Column Op() errors.Op IsPrimaryResult() bool }
func NewBaseTable ¶
type Column ¶
type Column interface { // Ordinal returns the column's index in the table. Index() int // Name returns the column's name. Name() string // Type returns the column's kusto data type. Type() types.Column }
Column represents a column in a table.
type Dataset ¶
type Dataset interface { BaseDataset Tables() []Table }
func NewDataset ¶
func NewDataset(base BaseDataset, tables []Table) Dataset
type IterativeDataset ¶
type IterativeDataset interface { BaseDataset Tables() <-chan TableResult ToDataset() (Dataset, error) Close() error }
IterativeDataset represents an iterative result from kusto - where the tables are streamed as they are received from the service.
type IterativeTable ¶
type IterativeTable interface { BaseTable // Rows returns a channel that will be populated with rows as they are read. Rows() <-chan RowResult ToTable() (Table, error) }
IterativeTable is a table that returns rows one at a time.
type Row ¶
type Row interface { // Index returns the index of the row. Index() int // Columns returns the columns of the table that the row belongs to. Columns() Columns // Values returns all the values in the row. Values() value.Values // Value returns the value at the specified index. Value(i int) (value.Kusto, error) ValueByColumn(c Column) (value.Kusto, error) // ValueByName returns the value with the specified column name. ValueByName(name string) (value.Kusto, error) // ToStruct converts the row into a struct and assigns it to the provided pointer. // It returns an error if the conversion fails. ToStruct(p interface{}) error // String returns a string representation of the row. String() string BoolByIndex(i int) (*bool, error) IntByIndex(i int) (*int32, error) LongByIndex(i int) (*int64, error) RealByIndex(i int) (*float64, error) DecimalByIndex(i int) (*decimal.Decimal, error) StringByIndex(i int) (string, error) DynamicByIndex(i int) ([]byte, error) DateTimeByIndex(i int) (*time.Time, error) TimespanByIndex(i int) (*time.Duration, error) GuidByIndex(i int) (*uuid.UUID, error) BoolByName(name string) (*bool, error) IntByName(name string) (*int32, error) LongByName(name string) (*int64, error) RealByName(name string) (*float64, error) DecimalByName(name string) (*decimal.Decimal, error) StringByName(name string) (string, error) DynamicByName(name string) ([]byte, error) DateTimeByName(name string) (*time.Time, error) TimespanByName(name string) (*time.Duration, error) GuidByName(name string) (*uuid.UUID, error) }
Row is an interface that represents a row in a table. It provides methods to access and manipulate the data in the row.
type RowResult ¶
RowResult is a single streamed row from a table. It can contain either a row or an error.
func RowResultError ¶
func RowResultSuccess ¶
type StructResult ¶
type TableResult ¶
type TableResult interface { Table() IterativeTable Err() error }
func TableResultError ¶
func TableResultError(err error) TableResult
func TableResultSuccess ¶
func TableResultSuccess(table IterativeTable) TableResult