kusto

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2022 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

Package kusto provides a client for accessing Azure Data Explorer, also known as Kusto.

For details on the Azure Kusto service, see: https://azure.microsoft.com/en-us/services/data-explorer/

For general documentation on APIs and the Kusto query language, see: https://docs.microsoft.com/en-us/azure/data-explorer/

Creating an Authorizer and a Client

To begin using this package, create an Authorizer and a client targeting your Kusto endpoint:

// auth package is: "github.com/Azure/go-autorest/autorest/azure/auth"

authorizer := kusto.Authorization{
	Config: auth.NewClientCredentialsConfig(clientID, clientSecret, tenantID),
}

client, err := kusto.New(endpoint, authorizer)
if err != nil {
	panic("add error handling")
}

For more examples on ways to create an Authorization object, see the Authorization object documentation.

Querying for Rows

Kusto provides a single method for querying, Query(). Query uses a Stmt object to provides SQL-like injection protection and accepts only string constants for arguments.

// table package is: data/table

// Query our database table "systemNodes" for the CollectionTimes and the NodeIds.
iter, err := client.Query(ctx, "database", kusto.NewStmt("systemNodes | project CollectionTime, NodeId"))
if err != nil {
	panic("add error handling")
}
defer iter.Stop()

// .Do() will call the function for every row in the table.
err = iter.Do(
	func(row *table.Row) error {
		if row.Replace {
			fmt.Println("---") // Replace flag indicates that the query result should be cleared and replaced with this row
		}
		fmt.Println(row) // As a convenience, printing a *table.Row will output csv
		return nil
	},
)
if err != nil {
	panic("add error handling")
}

Querying Rows Into Structs

Keeping our query the same, instead of printing the Rows we will simply put them into a slice of structs

// NodeRec represents our Kusto data that will be returned.
type NodeRec struct {
	// ID is the table's NodeId. We use the field tag here to to instruct our client to convert NodeId to ID.
	ID int64 `kusto:"NodeId"`
	// CollectionTime is Go representation of the Kusto datetime type.
	CollectionTime time.Time
}

iter, err := client.Query(ctx, "database", kusto.NewStmt("systemNodes | project CollectionTime, NodeId"))
if err != nil {
	panic("add error handling")
}
defer iter.Stop()

recs := []NodeRec{}
err = iter.Do(
	func(row *table.Row) error {
		rec := NodeRec{}
		if err := row.ToStruct(&rec); err != nil {
			return err
		}
		if row.Replace {
			recs = recs[:0]  // Replace flag indicates that the query result should be cleared and replaced with this row
		}
		recs = append(recs, rec)
		return nil
	},
)
if err != nil {
	panic("add error handling")
}

A struct object can use fields to store the Kusto values as normal Go values, pointers to Go values and as value.Kusto types. The value.Kusto types are useful when you need to distiguish between the zero value of a variable and the value not being set in Kusto.

All value.Kusto types have a .Value and .Valid field. .Value is the native Go value, .Valid is a bool which indicates if the value was set. More information can be found in the sub-package data/value.

The following is a conversion table from the Kusto column types to native Go values within a struct that are allowed:

From Kusto Type			To Go Kusto Type
==============================================================================
bool				value.Bool, bool, *bool
------------------------------------------------------------------------------
datetime			value.DateTime, time.Time, *time.Time
------------------------------------------------------------------------------
dynamic				value.Dynamic, string, *string
------------------------------------------------------------------------------
guid				value.GUID, uuid.UUID, *uuid.UUID
------------------------------------------------------------------------------
int				value.Int, int32, *int32
------------------------------------------------------------------------------
long				value.Long, int64, *int64
------------------------------------------------------------------------------
real				value.Real, float64, *float64
------------------------------------------------------------------------------
string				value.String, string, *string
------------------------------------------------------------------------------
timestamp			value.Timestamp, time.Duration, *time.Duration
------------------------------------------------------------------------------
decimal				value.Decimal, string, *string
==============================================================================

For more information on Kusto scalar types, see: https://docs.microsoft.com/en-us/azure/kusto/query/scalar-data-types/

Stmt

Every query is done using a Stmt. A Stmt is built with Go string constants and can do variable substitution using Kusto's Query Paramaters.

// rootStmt builds a query that will gather all nodes in the DB.
rootStmt := kusto.NewStmt("systemNodes | project CollectionTime, NodeId")

// singleNodeStmt creates a new Stmt based on rootStmt and adds a "where" clause to find a single node.
// We pass a definition that sets the word ParamNodeId to a variable that will be substituted for a
// Kusto Long type (which is a a Go int64).
singleNodeStmt := rootStmt.Add(" | where NodeId == ParamNodeId").MustDefinitions(
	kusto.NewDefinitions().Must(
		kusto.ParamTypes{
			"ParamNodeId": kusto.ParamType{Type: types.Long},
		},
	),
)

// Query using our singleNodeStmt, variable substituting for ParamNodeId
iter, err := client.Query(
	ctx,
	"database",
	singleNode.MustParameters(
		kusto.NewParameters().Must(
			kusto.QueryValues{"ParamNodeId": int64(100)},
		),
	),
)

Ingest

Support for Kusto ingestion from local files, Azure Blob Storage and streaming is supported in the sub-package ingest. See documentation in that package for more details

Mocking

To support mocking for this client in your code for hermetic testing purposes, this client supports mocking the data returned by our RowIterator object. Please see the MockRows documentation for code examples.

Package Examples

Below you will find a simple and complex example of doing Query() the represent compiled code:

Example (Complex)
// This example sets up a Query where we want to query for nodes that have a NodeId (a Kusto Long type) that has a
// particular NodeId. The will require inserting a value where ParamNodeId is in the query. We create the query
// and attach a Definition to it that indicates which words we will be substituing for and what the expected type will be.
// the MustDefinitions() will panic if the Definition is not valid. There is a non-panicing version that returns an
// error instead.
rootStmt := NewStmt("systemNodes | project CollectionTime, NodeId | where NodeId == ParamNodeId").MustDefinitions(
	NewDefinitions().Must(
		ParamTypes{
			"ParamNodeId": ParamType{Type: types.Long},
		},
	),
)

// This takes our rootStmt and creates a new Stmt that will insert 100 where ParamNodeId is in the rootStmt.
// rootStmt will remain unchanged. The Must() will panic if the QueryValues{} passed is not valid. This can
// happen because you use a type that isn't valid, like a string or int32.
// There is a non-panicing version that returns an error instead.
stmt, err := rootStmt.WithParameters(NewParameters().Must(QueryValues{"ParamNodeId": int64(100)}))
if err != nil {
	panic("add error handling")
}

// NodeRec represents our Kusto data that will be returned.
type NodeRec struct {
	// ID is the table's NodeId. We use the field tag here to to instruct our client to convert NodeId in the Kusto
	// table to ID in our struct.
	ID int64 `kusto:"NodeId"`
	// CollectionTime is Go representation of the Kusto datetime type.
	CollectionTime time.Time
}

kcsb := NewConnectionStringBuilder("endpoint").WithAadAppKey("clientID", "clientSecret", "tenentID")

client, err := New(kcsb)
if err != nil {
	panic("add error handling")
}
// Be sure to close the client when you're done. (Error handling omitted for brevity.)
defer client.Close()

ctx := context.Background()

// Query our database table "systemNodes" for our specific node. We are only doing a single query here as an example,
// normally you would take in requests of some type for different NodeIds.
iter, err := client.Query(ctx, "database", stmt)
if err != nil {
	panic("add error handling")
}
defer iter.Stop()

rec := NodeRec{} // We are assuming unique NodeId, so we will only get 1 row.
err = iter.Do(
	func(row *table.Row) error {
		return row.ToStruct(&rec)
	},
)

if err != nil {
	panic("add error handling")
}

fmt.Println(rec.ID)
Output:

Example (Simple)
// Query and capture the values and put them in a slice of structs representing the row.

// NodeRec represents our Kusto data that will be returned.
type NodeRec struct {
	// ID is the table's NodeId. We use the field tag here to to instruct our client to convert NodeId to ID.
	ID int64 `kusto:"NodeId"`
	// CollectionTime is Go representation of the Kusto datetime type.
	CollectionTime time.Time
}

kcsb := NewConnectionStringBuilder("endpoint").WithAadAppKey("clientID", "clientSecret", "tenentID")
client, err := New(kcsb)
if err != nil {
	panic("add error handling")
}

// Be sure to close the client when you're done. (Error handling omitted for brevity.)
defer client.Close()

ctx := context.Background()

// Query our database table "systemNodes" for the CollectionTimes and the NodeIds.
iter, err := client.Query(ctx, "database", NewStmt("systemNodes | project CollectionTime, NodeId"))
if err != nil {
	panic("add error handling")
}
defer iter.Stop()

var recs []NodeRec

err = iter.DoOnRowOrError(
	func(row *table.Row, e *kustoErrors.Error) error {
		if e != nil {
			return e
		}
		rec := NodeRec{}
		if err := row.ToStruct(&rec); err != nil {
			return err
		}
		if row.Replace {
			recs = recs[:0]
		}
		recs = append(recs, rec)
		return nil
	},
)

if err != nil {
	panic("add error handling")
}

for _, rec := range recs {
	fmt.Println(rec.ID)
}
Output:

Index

Examples

Constants

View Source
const (
	// DSDefault is used to set a query's datascope to default.
	DSDefault dataScope = "default"
	// DSAll is used to set a query's datascope to all.
	DSAll dataScope = "all"
	// DSHotCache is used to set a query's datascope to hotcache.
	DSHotCache dataScope = "hotcache"
)
View Source
const (
	BEARER_TYPE = "Bearer"
)
View Source
const ClientMaxRedirectCountValue = "client_max_redirect_count"
View Source
const DeferPartialQueryFailuresValue = "deferpartialqueryfailures"
View Source
const MaterializedViewShuffleValue = "materialized_view_shuffle"
View Source
const MaxMemoryConsumptionPerIteratorValue = "maxmemoryconsumptionperiterator"
View Source
const MaxMemoryConsumptionPerQueryPerNodeValue = "max_memory_consumption_per_query_per_node"
View Source
const MaxOutputColumnsValue = "maxoutputcolumns"
View Source
const NoRequestTimeoutValue = "norequesttimeout"
View Source
const NoTruncationValue = "notruncation"
View Source
const PushSelectionThroughAggregationValue = "push_selection_through_aggregation"
View Source
const QueryBinAutoAtValue = "query_bin_auto_at"
View Source
const QueryBinAutoSizeValue = "query_bin_auto_size"
View Source
const QueryConsistencyValue = "queryconsistency"
View Source
const QueryCursorAfterDefaultValue = "query_cursor_after_default"
View Source
const QueryCursorBeforeOrAtDefaultValue = "query_cursor_before_or_at_default"
View Source
const QueryCursorCurrentValue = "query_cursor_current"
View Source
const QueryCursorDisabledValue = "query_cursor_disabled"
View Source
const QueryCursorScopedTablesValue = "query_cursor_scoped_tables"
View Source
const QueryDatascopeValue = "query_datascope"
View Source
const QueryDateTimeScopeColumnValue = "query_datetimescope_column"
View Source
const QueryDateTimeScopeFromValue = "query_datetimescope_from"
View Source
const QueryDateTimeScopeToValue = "query_datetimescope_to"
View Source
const QueryDistributionNodesSpanValue = "query_distribution_nodes_span"
View Source
const QueryFanoutNodesPercentValue = "query_fanout_nodes_percent"
View Source
const QueryFanoutThreadsPercentValue = "query_fanout_threads_percent"
View Source
const QueryForceRowLevelSecurityValue = "query_force_row_level_security"
View Source
const QueryLanguageValue = "query_language"
View Source
const QueryLogQueryParametersValue = "query_log_query_parameters"
View Source
const QueryMaxEntitiesInUnionValue = "query_max_entities_in_union"
View Source
const QueryNowValue = "query_now"
View Source
const QueryPythonDebugValue = "query_python_debug"
View Source
const QueryResultsApplyGetschemaValue = "query_results_apply_getschema"
View Source
const QueryResultsCacheMaxAgeValue = "query_results_cache_max_age"
View Source
const QueryResultsCachePerShardValue = "query_results_cache_per_shard"
View Source
const QueryResultsProgressiveRowCountValue = "query_results_progressive_row_count"
View Source
const QueryResultsProgressiveUpdatePeriodValue = "query_results_progressive_update_period"
View Source
const QueryTakeMaxRecordsValue = "query_take_max_records"
View Source
const RequestAppNameValue = "request_app_name"
View Source
const RequestBlockRowLevelSecurityValue = "request_block_row_level_security"
View Source
const RequestCalloutDisabledValue = "request_callout_disabled"
View Source
const RequestDescriptionValue = "request_description"
View Source
const RequestExternalTableDisabledValue = "request_external_table_disabled"
View Source
const RequestImpersonationDisabledValue = "request_impersonation_disabled"
View Source
const RequestReadonlyValue = "request_readonly"
View Source
const RequestRemoteEntitiesDisabledValue = "request_remote_entities_disabled"
View Source
const RequestSandboxedExecutionDisabledValue = "request_sandboxed_execution_disabled"
View Source
const RequestUserValue = "request_user"
View Source
const ServerTimeoutValue = "servertimeout"
View Source
const TruncationMaxRecordsValue = "truncation_max_records"
View Source
const TruncationMaxSizeValue = "truncation_max_size"
View Source
const ValidatePermissionsValue = "validate_permissions"

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorization

type Authorization struct {
	// Token provider that can be used to get the access token.
	TokenProvider *TokenProvider
}

Authorization provides the TokenProvider needed to acquire the auth token.

Example (Config)
kcsb := NewConnectionStringBuilder("endpoint").WithAadAppKey("clientID", "clientSecret", "tenentID")

// Normally here you take a client.
_, err := New(kcsb)
if err != nil {
	panic("add error handling")
}
Output:

Example (Msi)
kcsb := NewConnectionStringBuilder("endpoint").WithUserManagedIdentity("clientID")

// Normally here you take a client.
_, err := New(kcsb)
if err != nil {
	panic("add error handling")
}
Output:

type Client

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

Client is a client to a Kusto instance.

func New

func New(kcsb *ConnectionStringBuilder, options ...Option) (*Client, error)

New returns a new Client.

func NewMockClient

func NewMockClient() *Client

func (*Client) Auth

func (c *Client) Auth() Authorization

Auth returns the Authorization passed to New().

func (*Client) Close

func (c *Client) Close() error

func (*Client) Endpoint

func (c *Client) Endpoint() string

Endpoint returns the endpoint passed to New().

func (*Client) HttpClient

func (c *Client) HttpClient() *http.Client

func (*Client) Mgmt

func (c *Client) Mgmt(ctx context.Context, db string, query Stmt, options ...MgmtOption) (*RowIterator, error)

Mgmt is used to do management queries to Kusto. Details can be found at: https://docs.microsoft.com/en-us/azure/kusto/management/ Mgmt accepts a Stmt, but that Stmt cannot have any query parameters attached at this time. Note that the server has a timeout of 10 minutes for a management call by default unless the context deadline is set. There is a maximum of 1 hour.

func (*Client) Query

func (c *Client) Query(ctx context.Context, db string, query Stmt, options ...QueryOption) (*RowIterator, error)

Query queries Kusto for data. context can set a timeout or cancel the query. query is a injection safe Stmt object. Queries cannot take longer than 5 minutes by default and have row/size limitations. Note that the server has a timeout of 4 minutes for a query by default unless the context deadline is set. Queries can take a maximum of 1 hour.

Example (Do)
// This is similar to our (Row) example. In this one though, we use the RowIterator.Do() method instead of
// manually iterating over the row. This makes for shorter code while maintaining readability.

kcsb := NewConnectionStringBuilder("endpoint").WithAadAppKey("clientID", "clientSecret", "tenentID")

client, err := New(kcsb)
if err != nil {
	panic("add error handling")
}
// Be sure to close the client when you're done. (Error handling omitted for brevity.)
defer client.Close()

ctx := context.Background()

// Query our database table "systemNodes" for the CollectionTimes and the NodeIds.
iter, err := client.Query(ctx, "database", NewStmt("systemNodes | project CollectionTime, NodeId"))
if err != nil {
	panic("add error handling")
}
defer iter.Stop()

// Iterate through the returned rows until we get an error or receive an io.EOF, indicating the end of
// the data being returned.

err = iter.Do(
	func(row *table.Row) error {
		if row.Replace {
			fmt.Println("---") // Replace flag indicates that the query result should be cleared and replaced with this row
		}
		for _, v := range row.Values {
			fmt.Printf("%s,", v)
		}
		fmt.Println("") // Add a carriage return
		return nil
	},
)
if err != nil {
	panic("add error handling")
}
Output:

Example (Rows)
kcsb := NewConnectionStringBuilder("endpoint").WithAadAppKey("clientID", "clientSecret", "tenentID")

client, err := New(kcsb)
if err != nil {
	panic("add error handling")
}
// Be sure to close the client when you're done. (Error handling omitted for brevity.)
defer client.Close()

ctx := context.Background()

// Query our database table "systemNodes" for the CollectionTimes and the NodeIds.
iter, err := client.Query(ctx, "database", NewStmt("systemNodes | project CollectionTime, NodeId"))
if err != nil {
	panic("add error handling")
}
defer iter.Stop()

// Iterate through the returned rows until we get an error or receive an io.EOF, indicating the end of
// the data being returned.
for {
	row, err := iter.Next()
	if err != nil {
		if err == io.EOF {
			break
		}
		if err != nil {
			panic("add error handling")
		}
	}

	// Print out the row values
	for _, v := range row.Values {
		fmt.Printf("%s,", v)
	}
	fmt.Println("") // Add a carriage return
}
Output:

Example (Struct)
// Capture our values into a struct and sends those values into a channel. Normally this would be done between
// a couple of functions representing a sender and a receiver.

// NodeRec represents our Kusto data that will be returned.
type NodeRec struct {
	// ID is the table's NodeId. We use the field tag here to to instruct our client to convert NodeId to ID.
	ID int64 `kusto:"NodeId"`
	// CollectionTime is Go representation of the Kusto datetime type.
	CollectionTime time.Time

	// err is used internally to signal downstream that we encounter an error.
	err error
}

kcsb := NewConnectionStringBuilder("endpoint").WithAadAppKey("clientID", "clientSecret", "tenentID")

client, err := New(kcsb)
if err != nil {
	panic("add error handling")
}
// Be sure to close the client when you're done. (Error handling omitted for brevity.)
defer client.Close()

ctx := context.Background()

// Query our database table "systemNodes" for the CollectionTimes and the NodeIds.
iter, err := client.Query(ctx, "database", NewStmt("systemNodes | project CollectionTime, NodeId"))
if err != nil {
	panic("add error handling")
}
defer iter.Stop()

// printCh is used to receive NodeRecs for printing.
printCh := make(chan NodeRec, 1)

// Iterate through the returned rows, convert them to NodeRecs and send them on printCh to be printed.
go func() {
	// Note: we ignore the error here because we send it on a channel and an error will automatically
	// end the iteration.
	_ = iter.Do(
		func(row *table.Row) error {
			rec := NodeRec{}
			rec.err = row.ToStruct(&rec)
			printCh <- rec
			return rec.err
		},
	)
}()

// Receive the NodeRecs on printCh and print them to the screen.
wg := sync.WaitGroup{}
wg.Add(1)
go func() {
	defer wg.Done()
	for rec := range printCh {
		if rec.err != nil {
			fmt.Println("Got error: ", err)
			return
		}
		fmt.Printf("NodeID: %d, CollectionTime: %s\n", rec.ID, rec.CollectionTime)
	}
}()

wg.Wait()
Output:

func (*Client) QueryToJson

func (c *Client) QueryToJson(ctx context.Context, db string, query Stmt, options ...QueryOption) (string, error)

type CloudInfo added in v0.10.2

type CloudInfo struct {
	LoginEndpoint          string `json:"LoginEndpoint"`
	LoginMfaRequired       bool   `json:"LoginMfaRequired"`
	KustoClientAppID       string `json:"KustoClientAppId"`
	KustoClientRedirectURI string `json:"KustoClientRedirectUri"`
	KustoServiceResourceID string `json:"KustoServiceResourceId"`
	FirstPartyAuthorityURL string `json:"FirstPartyAuthorityUrl"`
}

func GetMetadata added in v0.10.2

func GetMetadata(kustoUri string, httpClient *http.Client) (CloudInfo, error)

type ConnectionStringBuilder added in v0.10.2

type ConnectionStringBuilder struct {
	DataSource                       string
	AadUserID                        string
	Password                         string
	UserToken                        string
	ApplicationClientId              string
	ApplicationKey                   string
	AuthorityId                      string
	ApplicationCertificate           string
	ApplicationCertificateThumbprint string
	SendCertificateChain             bool
	ApplicationToken                 string
	AzCli                            bool
	MsiAuthentication                bool
	ManagedServiceIdentity           string
	InteractiveLogin                 bool
	RedirectURL                      string
	DefaultAuth                      bool
	ClientOptions                    *azcore.ClientOptions
}

func NewConnectionStringBuilder added in v0.10.2

func NewConnectionStringBuilder(connStr string) *ConnectionStringBuilder

NewConnectionStringBuilder Creates new Kusto ConnectionStringBuilder. Params takes kusto connection string connStr: string. Kusto connection string should be of the format: https://<clusterName>.kusto.windows.net;AAD User ID="user@microsoft.com";Password=P@ssWord For more information please look at: https://docs.microsoft.com/azure/data-explorer/kusto/api/connection-strings/kusto

func (*ConnectionStringBuilder) AttachPolicyClientOptions added in v0.10.2

func (kcsb *ConnectionStringBuilder) AttachPolicyClientOptions(options *azcore.ClientOptions) *ConnectionStringBuilder

AttachPolicyClientOptions Assigns ClientOptions to string builder that contains configuration settings like Logging and Retry configs for a client's pipeline. Read more at https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore@v1.2.0/policy#ClientOptions

func (*ConnectionStringBuilder) WitAadUserToken added in v0.10.2

func (kcsb *ConnectionStringBuilder) WitAadUserToken(usertoken string) *ConnectionStringBuilder

WitAadUserToken Creates a Kusto Connection string builder that will authenticate with AAD user token

func (*ConnectionStringBuilder) WithAadAppKey added in v0.10.2

func (kcsb *ConnectionStringBuilder) WithAadAppKey(appId string, appKey string, authorityID string) *ConnectionStringBuilder

WithAadAppKey Creates a Kusto Connection string builder that will authenticate with AAD application and key.

func (*ConnectionStringBuilder) WithAadUserPassAuth added in v0.10.2

func (kcsb *ConnectionStringBuilder) WithAadUserPassAuth(uname string, pswrd string, authorityID string) *ConnectionStringBuilder

WithAadUserPassAuth Creates a Kusto Connection string builder that will authenticate with AAD user name and password.

func (*ConnectionStringBuilder) WithAppCertificate added in v0.10.2

func (kcsb *ConnectionStringBuilder) WithAppCertificate(appId string, certificate string, thumprint string, sendCertChain bool, authorityID string) *ConnectionStringBuilder

WithAppCertificate Creates a Kusto Connection string builder that will authenticate with AAD application using a certificate.

func (*ConnectionStringBuilder) WithApplicationToken added in v0.10.2

func (kcsb *ConnectionStringBuilder) WithApplicationToken(appId string, appToken string) *ConnectionStringBuilder

WithApplicationToken Creates a Kusto Connection string builder that will authenticate with AAD application and an application token.

func (*ConnectionStringBuilder) WithAzCli added in v0.10.2

WithAzCli Creates a Kusto Connection string builder that will use existing authenticated az cli profile password.

func (*ConnectionStringBuilder) WithDefaultAzureCredential added in v0.10.2

func (kcsb *ConnectionStringBuilder) WithDefaultAzureCredential() *ConnectionStringBuilder

WithDefaultAzureCredential Create Kusto Conntection String that will be used for default auth mode. The order of auth will be via environment variables, managed identity and Azure CLI . Read more at https://learn.microsoft.com/azure/developer/go/azure-sdk-authentication?tabs=bash#2-authenticate-with-azure

func (*ConnectionStringBuilder) WithInteractiveLogin added in v0.10.2

func (kcsb *ConnectionStringBuilder) WithInteractiveLogin(authorityID string) *ConnectionStringBuilder

WithInteractiveLogin Creates a Kusto Connection string builder that will authenticate by launching the system default browser to interactively authenticate a user, and obtain an access token

func (*ConnectionStringBuilder) WithSystemManagedIdentity added in v0.10.2

func (kcsb *ConnectionStringBuilder) WithSystemManagedIdentity() *ConnectionStringBuilder

WithSystemManagedIdentity Creates a Kusto Connection string builder that will authenticate with AAD application, using an application token obtained from a Microsoft Service Identity endpoint using system assigned id.

func (*ConnectionStringBuilder) WithUserManagedIdentity added in v0.10.2

func (kcsb *ConnectionStringBuilder) WithUserManagedIdentity(clientID string) *ConnectionStringBuilder

WithUserManagedIdentity Creates a Kusto Connection string builder that will authenticate with AAD application, using an application token obtained from a Microsoft Service Identity endpoint using user assigned id.

type DataScope

type DataScope interface {
	// contains filtered or unexported methods
}

DataScope is used with QueryDataScope() to control a query's datascope.

type Definitions

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

Definitions represents definitions of parameters that are substituted for variables in a Kusto Query. This provides both variable substitution in a Stmt and provides protection against SQL-like injection attacks. See https://docs.microsoft.com/en-us/azure/kusto/query/queryparametersstatement?pivots=azuredataexplorer for internals. This object is not thread-safe and passing it as an argument to a function will create a copy that will share the internal state with the original.

func NewDefinitions

func NewDefinitions() Definitions

NewDefinitions is the constructor for Definitions.

func (Definitions) IsZero

func (p Definitions) IsZero() bool

IsZero indicates if the Definitions object is the zero type.

func (Definitions) Must

func (p Definitions) Must(types ParamTypes) Definitions

Must is the same as With(), but it must succeed or it panics.

func (Definitions) String

func (p Definitions) String() string

String implements fmt.Stringer.

func (Definitions) With

func (p Definitions) With(types ParamTypes) (Definitions, error)

With returns a copy of the Definitions object with the parameters names and types defined in "types".

type MgmtOption

type MgmtOption func(m *mgmtOptions) error

MgmtOption is an option type for a call to Mgmt().

func AllowWrite deprecated

func AllowWrite() MgmtOption

Deprecated: Writing mode is now the default. Use the `RequestReadonly` option to make a read-only request.

func IngestionEndpoint

func IngestionEndpoint() MgmtOption

IngestionEndpoint will instruct the Mgmt call to connect to the ingest-[endpoint] instead of [endpoint]. This is not often used by end users and can only be used with a Mgmt() call.

type MockRows

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

MockRows provides the abilty to provide mocked Row data that can be played back from a RowIterator. This allows for creating hermetic tests from mock data or creating mock data from a real data fetch.

func NewMockRows

func NewMockRows(columns table.Columns) (*MockRows, error)

NewMockRows is the constructor for MockRows.

func (*MockRows) Error

func (m *MockRows) Error(err error) error

Error adds an error into the result stream. Nothing else added to this stream will matter once this is called.

func (*MockRows) Row

func (m *MockRows) Row(row value.Values) error

Row adds Row data that will be replayed in a RowIterator.

func (*MockRows) Struct

func (m *MockRows) Struct(p interface{}) error

Struct adds Row data that will be replayed in a RowIterator by parsing the passed *struct into value.Values.

type Option

type Option func(c *Client)

Option is an optional argument type for New().

func WithHttpClient

func WithHttpClient(client *http.Client) Option

type ParamType

type ParamType struct {
	// Type is the type of Column type this QueryParam will represent.
	Type types.Column
	// Default is a default value to use if the query doesn't provide this value.
	// The value that can be set is defined by the Type:
	// CTBool must be a bool
	// CTDateTime must be a time.Time
	// CTDynamic cannot have a default value
	// CTGuid must be an uuid.UUID
	// CTInt must be an int32
	// CTLong must be an int64
	// CTReal must be an float64
	// CTString must be a string
	// CTTimespan must be a time.Duration
	// CTDecimal must be a string or *big.Float representing a decimal value
	Default interface{}
	// contains filtered or unexported fields
}

ParamType provides type and default value information about the query parameter

type ParamTypes

type ParamTypes map[string]ParamType

ParamTypes is a list of parameter types and corresponding type data.

type Parameters

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

Parameters represents values that will be substituted for a Stmt's Parameter. Keys are the names of corresponding Parameters, values are the value to be used. Keys must exist in the Parameter and value must be a Go type that corresponds to the ParamType.

func NewParameters

func NewParameters() Parameters

NewParameters is the construtor for Parameters.

func (Parameters) IsZero

func (q Parameters) IsZero() bool

IsZero returns if Parameters is the zero value.

func (Parameters) Must

func (q Parameters) Must(values QueryValues) Parameters

Must is the same as With() except any error is a panic.

func (Parameters) With

func (q Parameters) With(values QueryValues) (Parameters, error)

With returns a Parameters set to "values". values' keys represents Definitions names that will substituted for and the values to be subsituted.

type QueryOption

type QueryOption func(q *queryOptions) error

QueryOption is an option type for a call to Query().

func Application added in v0.10.2

func Application(appName string) QueryOption

Application sets the x-ms-app header, and can be used to identify the application making the request in the `.show queries` output.

func ClientMaxRedirectCount

func ClientMaxRedirectCount(i int64) QueryOption

ClientMaxRedirectCount If set and positive, indicates the maximum number of HTTP redirects that the client will process.

func CustomQueryOption

func CustomQueryOption(paramName string, i interface{}) QueryOption

CustomQueryOption exists to allow a QueryOption that is not defined in the Go SDK, as all options are not defined. Please Note: you should always use the type safe options provided below when available. Also note that Kusto does not error on non-existent parameter names or bad values, it simply doesn't work as expected.

func DeferPartialQueryFailures

func DeferPartialQueryFailures() QueryOption

DeferPartialQueryFailures disables reporting partial query failures as part of the result set.

func MaterializedViewShuffle

func MaterializedViewShuffle(s string) QueryOption

MaterializedViewShuffle A hint to use shuffle strategy for materialized views that are referenced in the query. The property is an array of materialized views names and the shuffle keys to use. Examples: 'dynamic([ { "Name": "V1", "Keys" : [ "K1", "K2" ] } ])' (shuffle view V1 by K1, K2) or 'dynamic([ { "Name": "V1" } ])' (shuffle view V1 by all keys)

func MaxMemoryConsumptionPerIterator

func MaxMemoryConsumptionPerIterator(i uint64) QueryOption

MaxMemoryConsumptionPerIterator overrides the default maximum amount of memory a query operator may allocate.

func MaxMemoryConsumptionPerQueryPerNode

func MaxMemoryConsumptionPerQueryPerNode(i uint64) QueryOption

MaxMemoryConsumptionPerQueryPerNode overrides the default maximum amount of memory a whole query may allocate per node.

func MaxOutputColumns

func MaxOutputColumns(i int) QueryOption

MaxOutputColumns overrides the default maximum number of columns a query is allowed to produce.

func NoRequestTimeout

func NoRequestTimeout() QueryOption

NoRequestTimeout enables setting the request timeout to its maximum value.

func NoTruncation

func NoTruncation() QueryOption

NoTruncation enables suppressing truncation of the query results returned to the caller.

func PushSelectionThroughAggregation

func PushSelectionThroughAggregation() QueryOption

PushSelectionThroughAggregation will push simple selection through aggregation .

func QueryBinAutoAt

func QueryBinAutoAt(s string) QueryOption

QueryBinAutoAt When evaluating the bin_auto() function, the start value to use.

func QueryBinAutoSize

func QueryBinAutoSize(s string) QueryOption

QueryBinAutoSize When evaluating the bin_auto() function, the bin size value to use.

func QueryConsistency

func QueryConsistency(c string) QueryOption

QueryConsistency Controls query consistency

func QueryCursorAfterDefault

func QueryCursorAfterDefault(s string) QueryOption

QueryCursorAfterDefault sets the default parameter value of the cursor_after() function when called without parameters.

func QueryCursorBeforeOrAtDefault

func QueryCursorBeforeOrAtDefault(s string) QueryOption

QueryCursorBeforeOrAtDefault sets the default parameter value of the cursor_before_or_at() function when called without parameters.

func QueryCursorCurrent

func QueryCursorCurrent(s string) QueryOption

QueryCursorCurrent overrides the cursor value returned by the cursor_current() or current_cursor() functions.

func QueryCursorDisabled

func QueryCursorDisabled(s string) QueryOption

QueryCursorDisabled overrides the cursor value returned by the cursor_current() or current_cursor() functions.

func QueryCursorScopedTables

func QueryCursorScopedTables(l []string) QueryOption

QueryCursorScopedTables is a list of table names that should be scoped to cursor_after_default .. cursor_before_or_at_default (upper bound is optional).

func QueryDataScope

func QueryDataScope(ds DataScope) QueryOption

QueryDataScope controls the query's datascope -- whether the query applies to all data or just part of it. ['default', 'all', or 'hotcache']

func QueryDateTimeScopeColumn

func QueryDateTimeScopeColumn(s string) QueryOption

QueryDateTimeScopeColumn controls the column name for the query's datetime scope (query_datetimescope_to / query_datetimescope_from)

func QueryDateTimeScopeFrom

func QueryDateTimeScopeFrom(t time.Time) QueryOption

QueryDateTimeScopeFrom controls the query's datetime scope (earliest) -- used as auto-applied filter on query_datetimescope_column only (if defined).

func QueryDateTimeScopeTo

func QueryDateTimeScopeTo(t time.Time) QueryOption

QueryDateTimeScopeTo controls the query's datetime scope (latest) -- used as auto-applied filter on query_datetimescope_column only (if defined).

func QueryDistributionNodesSpan

func QueryDistributionNodesSpan(i int64) QueryOption

QueryDistributionNodesSpan If set, controls the way the subquery merge behaves: the executing node will introduce an additional level in the query hierarchy for each subgroup of nodes; the size of the subgroup is set by this option.

func QueryFanoutNodesPercent

func QueryFanoutNodesPercent(i int) QueryOption

QueryFanoutNodesPercent The percentage of nodes to fan out execution to.

func QueryFanoutThreadsPercent

func QueryFanoutThreadsPercent(i int) QueryOption

QueryFanoutThreadsPercent The percentage of threads to fan out execution to.

func QueryForceRowLevelSecurity

func QueryForceRowLevelSecurity() QueryOption

QueryForceRowLevelSecurity If specified, forces Row Level Security rules, even if row_level_security policy is disabled

func QueryLanguage

func QueryLanguage(s string) QueryOption

QueryLanguage Controls how the query text is to be interpreted (Kql or Sql).

func QueryLogQueryParameters

func QueryLogQueryParameters() QueryOption

QueryLogQueryParameters Enables logging of the query parameters, so that they can be viewed later in the .show queries journal.

func QueryMaxEntitiesInUnion

func QueryMaxEntitiesInUnion(i int64) QueryOption

QueryMaxEntitiesInUnion Overrides the default maximum number of entities in a union.

func QueryNow

func QueryNow(t time.Time) QueryOption

QueryNow Overrides the datetime value returned by the now(0s) function.

func QueryPythonDebug

func QueryPythonDebug(i int) QueryOption

QueryPythonDebug If set, generate python debug query for the enumerated python node (default first).

func QueryResultsApplyGetschema

func QueryResultsApplyGetschema() QueryOption

QueryResultsApplyGetschema If set, retrieves the schema of each tabular data in the results of the query instead of the data itself.

func QueryResultsCacheMaxAge

func QueryResultsCacheMaxAge(d time.Duration) QueryOption

QueryResultsCacheMaxAge If positive, controls the maximum age of the cached query results the service is allowed to return

func QueryResultsCachePerShard

func QueryResultsCachePerShard() QueryOption

QueryResultsCachePerShard If set, enables per-shard query cache.

func QueryResultsProgressiveRowCount

func QueryResultsProgressiveRowCount(i int64) QueryOption

QueryResultsProgressiveRowCount Hint for Kusto as to how many records to send in each update (takes effect only if OptionResultsProgressiveEnabled is set)

func QueryResultsProgressiveUpdatePeriod

func QueryResultsProgressiveUpdatePeriod(i int32) QueryOption

QueryResultsProgressiveUpdatePeriod Hint for Kusto as to how often to send progress frames (takes effect only if OptionResultsProgressiveEnabled is set)

func QueryTakeMaxRecords

func QueryTakeMaxRecords(i int64) QueryOption

QueryTakeMaxRecords Enables limiting query results to this number of records.

func RequestAppName

func RequestAppName(s string) QueryOption

RequestAppName Request application name to be used in the reporting (e.g. show queries). Does not set the `Application` property in `.show queries`, see `Application` for that.

func RequestBlockRowLevelSecurity

func RequestBlockRowLevelSecurity() QueryOption

RequestBlockRowLevelSecurity If specified, blocks access to tables for which row_level_security policy is enabled.

func RequestCalloutDisabled

func RequestCalloutDisabled() QueryOption

RequestCalloutDisabled If specified, indicates that the request can't call-out to a user-provided service.

func RequestDescription

func RequestDescription(s string) QueryOption

RequestDescription Arbitrary text that the author of the request wants to include as the request description.

func RequestExternalTableDisabled

func RequestExternalTableDisabled() QueryOption

RequestExternalTableDisabled If specified, indicates that the request can't invoke code in the ExternalTable.

func RequestImpersonationDisabled

func RequestImpersonationDisabled() QueryOption

RequestImpersonationDisabled If specified, indicates that the service should not impersonate the caller's identity.

func RequestReadonly

func RequestReadonly() QueryOption

RequestReadonly If specified, indicates that the request can't write anything.

func RequestRemoteEntitiesDisabled

func RequestRemoteEntitiesDisabled() QueryOption

RequestRemoteEntitiesDisabled If specified, indicates that the request can't access remote databases and clusters.

func RequestSandboxedExecutionDisabled

func RequestSandboxedExecutionDisabled() QueryOption

RequestSandboxedExecutionDisabled If specified, indicates that the request can't invoke code in the sandbox.

func RequestUser

func RequestUser(s string) QueryOption

RequestUser Request user to be used in the reporting (e.g. show queries). Does not set the `User` property in `.show queries`, see `User` for that.

func ResultsProgressiveDisable

func ResultsProgressiveDisable() QueryOption

ResultsProgressiveDisable disables the progressive query stream.

func TruncationMaxRecords

func TruncationMaxRecords(i int64) QueryOption

TruncationMaxRecords Overrides the default maximum number of records a query is allowed to return to the caller (truncation).

func TruncationMaxSize

func TruncationMaxSize(i int64) QueryOption

TruncationMaxSize Overrides the default maximum data size a query is allowed to return to the caller (truncation).

func User added in v0.10.2

func User(userName string) QueryOption

User sets the x-ms-user header, and can be used to identify the user making the request in the `.show queries` output.

func ValidatePermissions

func ValidatePermissions() QueryOption

ValidatePermissions Validates user's permissions to perform the query and doesn't run the query itself.

type QueryValues

type QueryValues map[string]interface{}

QueryValues represents a set of values that are substituted in Parameters. Every QueryValue key must have a corresponding Parameter name. All values must be compatible with the Kusto Column type it will go into (int64 for a long, int32 for int, time.Time for datetime, ...)

type Row

type Row struct {
	Values  value.Values
	Error   *errors.Error
	Replace bool
}

Row is a row of data from Kusto, or an error. Replace indicates whether the existing result set should be cleared and replaced with this row.

type RowIterator

type RowIterator struct {

	// RequestHeader is the http.Header sent in the request to the server.
	RequestHeader http.Header
	// ResponseHeader is the http.header sent in the response from the server.
	ResponseHeader http.Header
	// contains filtered or unexported fields
}

RowIterator is used to iterate over the returned Row objects returned by Kusto.

func (*RowIterator) Do deprecated

func (r *RowIterator) Do(f func(r *table.Row) error) error

Deprecated: Use DoOnRowOrError() instead for more robust error handling. In a future version, this will be removed, and NextRowOrError will replace it. Do calls f for every row returned by the query. If f returns a non-nil error, iteration stops. This method will fail on errors inline within the rows, even though they could potentially be recovered and more data might be available. This behavior is to keep the interface compatible.

func (*RowIterator) DoOnRowOrError

func (r *RowIterator) DoOnRowOrError(f func(r *table.Row, e *errors.Error) error) error

DoOnRowOrError calls f for every row returned by the query. If errors occur inline within the rows, they are passed to f. Other errors will stop the iteration and be returned. If f returns a non-nil error, iteration stops.

func (*RowIterator) GetExtendedProperties

func (r *RowIterator) GetExtendedProperties() (v2.DataTable, error)

GetExtendedProperties will return the extended properties' table from the iterator, if it exists. Returns io.ErrUnexpectedEOF if not found. May not have all tables until RowIterator has reached io.EOF.

func (*RowIterator) GetNonPrimary

func (r *RowIterator) GetNonPrimary(tableKind, tableName frames.TableKind) (v2.DataTable, error)

GetNonPrimary will return a non-primary dataTable if it exists from the last query. The non-primary table and common names are defined under the frames.TableKind enum. Returns io.ErrUnexpectedEOF if not found. May not have all tables until RowIterator has reached io.EOF.

func (*RowIterator) GetQueryCompletionInformation

func (r *RowIterator) GetQueryCompletionInformation() (v2.DataTable, error)

GetQueryCompletionInformation will return the query completion information table from the iterator, if it exists. Returns io.ErrUnexpectedEOF if not found. May not have all tables until RowIterator has reached io.EOF.

func (*RowIterator) Mock

func (r *RowIterator) Mock(m *MockRows) error

Mock is used to tell the RowIterator to return specific data for tests. This is useful when building fakes of the client's Query() call for hermetic tests. This can only be called in a test or it will panic.

func (*RowIterator) Next deprecated

func (r *RowIterator) Next() (row *table.Row, finalError error)

Deprecated: Use NextRowOrError() instead for more robust error handling. In a future version, this will be removed, and NextRowOrError will replace it. Next gets the next Row from the query. io.EOF is returned if there are no more entries in the output. This method will fail on errors inline within the rows, even though they could potentially be recovered and more data might be available. Once Next() returns an error, all subsequent calls will return the same error.

func (*RowIterator) NextRowOrError

func (r *RowIterator) NextRowOrError() (row *table.Row, inlineError *errors.Error, finalError error)

NextRowOrError gets the next Row or service-side error from the query. On partial success, inlineError will be set. Once finalError returns non-nil, all subsequent calls will return the same error. finalError will be set to io.EOF is when frame parsing completed with success or partial success (data + errors). if finalError is not io.EOF, reading the frame has resulted in a failure state (no data is expected).

func (*RowIterator) Progress

func (r *RowIterator) Progress() float64

Progress returns the progress of the query, 0-100%. This is only valid on Progressive data returns.

func (*RowIterator) Progressive

func (r *RowIterator) Progressive() bool

Progressive indicates if the RowIterator is unpacking progressive (streaming) frames.

func (*RowIterator) Stop

func (r *RowIterator) Stop()

Stop is called to stop any further iteration. Always defer a Stop() call after receiving a RowIterator.

type Stmt

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

Stmt is a Kusto Query statement. A Stmt is thread-safe, but methods on the Stmt are not. All methods on a Stmt do not alter the statement, they return a new Stmt object with the changes. This includes a copy of the Definitions and Parameters objects, if provided. This allows a root Stmt object that can be built upon. You should not pass *Stmt objects.

Example
package main

import (
	"fmt"

	"github.com/andyliuliming/azure-kusto-go/kusto"
	"github.com/andyliuliming/azure-kusto-go/kusto/data/types"
)

const (
	// qRoot is a a root query text that will be used in a Stmt. It contains everything that any
	// other Stmt objects will need.
	qRoot = "set notruncation;dcmInventoryComponentSystem\n| project NodeId, Version"
	// singleNode includes syntax that will be included only when we want to grab a single node.
	// The word "Node" here is substituted for variable.
	singleNode = "\n| where NodeId == Node\n"
)

var (
	// rootStmt represents our root Stmt object in which we can derive other Stmts. This definition
	// will always include NodeId and Version fields.
	rootStmt = kusto.NewStmt(qRoot)
	// singleStmt is derived from the rootStmt but includes a where clause to limit the query to a
	// single node. You will see that we input a Definitions object to define the "Node" word in the
	// query as a string.
	singleStmt = rootStmt.Add(singleNode).MustDefinitions(
		kusto.NewDefinitions().Must(
			kusto.ParamTypes{
				"Node": kusto.ParamType{Type: types.String},
			},
		),
	)
)

func main() {
	var err error

	// This will print the rootStmt that could be used to list all nodes in the table.
	fmt.Println("All Nodes Statement:\n", rootStmt.String())

	// If we wanted to query for a single node, we could build a Stmt fron singleStmt like so:
	params := kusto.NewParameters()
	params, err = params.With(kusto.QueryValues{"Node": "my_id"}) // Substitute "my_id" in every place in the query where "Node" is
	if err != nil {
		panic(err)
	}

	stmt, err := singleStmt.WithParameters(params)
	if err != nil {
		panic(err)
	}

	fmt.Println("Single Statement:\n", stmt)
	j, err := stmt.ValuesJSON()
	if err != nil {
		panic(err)
	}
	fmt.Println("Single Statement Parameters:\n", j)

	// Here is a more condensed version:
	stmt, err = singleStmt.WithParameters(kusto.NewParameters().Must(kusto.QueryValues{"Node": "my_id2"}))
	if err != nil {
		panic(err)
	}

	fmt.Println("Single Statement(Condensed):\n", stmt)

	// For repeated queries off a channel or loop, we can further optimize.
	params = kusto.NewParameters()
	qv := kusto.QueryValues{}

	qv["Node"] = "node id from channel"
	stmt, err = singleStmt.WithParameters(params.Must(qv))
	if err != nil {
		panic(err)
	}

	fmt.Println("Single Statement(Repeat):\n", stmt)

}
Output:

All Nodes Statement:
 set notruncation;dcmInventoryComponentSystem
| project NodeId, Version
Single Statement:
 declare query_parameters(Node:string);
set notruncation;dcmInventoryComponentSystem
| project NodeId, Version
| where NodeId == Node

Single Statement Parameters:
 {"Node":"my_id"}
Single Statement(Condensed):
 declare query_parameters(Node:string);
set notruncation;dcmInventoryComponentSystem
| project NodeId, Version
| where NodeId == Node

Single Statement(Repeat):
 declare query_parameters(Node:string);
set notruncation;dcmInventoryComponentSystem
| project NodeId, Version
| where NodeId == Node

func NewStmt

func NewStmt(query stringConstant, options ...StmtOption) Stmt

NewStmt creates a Stmt from a string constant.

func (Stmt) Add

func (s Stmt) Add(query stringConstant) Stmt

Add will add more text to the Stmt. This is similar to the + operator on two strings, except it only can be done with string constants. This allows dynamically building of a query from a root Stmt.

func (Stmt) MustDefinitions

func (s Stmt) MustDefinitions(defs Definitions) Stmt

MustDefinitions is the same as WithDefinitions with the exceptions that an error causes a panic.

func (Stmt) MustParameters

func (s Stmt) MustParameters(params Parameters) Stmt

MustParameters is the same as WithParameters with the exceptions that an error causes a panic.

func (Stmt) String

func (s Stmt) String() string

String implements fmt.Stringer. This can be used to see what the query statement to the server will be for debugging purposes.

func (Stmt) UnsafeAdd

func (s Stmt) UnsafeAdd(query string) Stmt

UnsafeAdd provides a method to add strings that are not injection protected to the Stmt. To utilize this method, you must create the Stmt with the UnsafeStmt() option and pass the unsafe.Stmt with .Add set to true. If not set, THIS WILL PANIC!

func (Stmt) ValuesJSON

func (s Stmt) ValuesJSON() (string, error)

ValuesJSON returns a string in JSON format representing the Kusto QueryOptions.Parameters value that will be passed to the server. These values are substitued for Definitions in the Stmt and are represented by the Parameters that was passed.

func (Stmt) WithDefinitions

func (s Stmt) WithDefinitions(defs Definitions) (Stmt, error)

WithDefinitions will return a Stmt that can be used in a Query() with Kusto Parameters to protect against SQL-like injection attacks. These Parameters must align with the placeholders in the statement. The new Stmt object will have a copy of the Parameters passed, not the original.

func (Stmt) WithParameters

func (s Stmt) WithParameters(params Parameters) (Stmt, error)

WithParameters returns a Stmt that has the Parameters that will be substituted for Definitions in the query. Must have supplied the appropriate Definitions using WithQueryParamaters().

type StmtOption

type StmtOption func(s *Stmt)

StmtOption is an optional argument to NewStmt().

func UnsafeStmt

func UnsafeStmt(options unsafe.Stmt) StmtOption

UnsafeStmt enables unsafe actions on a Stmt and all Stmts derived from that Stmt. This turns off safety features that could allow a service client to compromise your data store. USE AT YOUR OWN RISK!

type TableOfContents

type TableOfContents struct {
	Ordinal    int64
	Kind       string
	Name       string
	Id         string
	PrettyName string
}

type TokenProvider added in v0.10.2

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

func (*TokenProvider) AcquireToken added in v0.10.2

func (tkp *TokenProvider) AcquireToken(ctx context.Context) (string, string, error)

tokenProvider need to be received as reference, to reflect updations to the structs

func (*TokenProvider) AuthorizationRequired added in v0.10.2

func (tkp *TokenProvider) AuthorizationRequired() bool

func (*TokenProvider) SetHttp added in v0.10.2

func (tkp *TokenProvider) SetHttp(http *http.Client)

Directories

Path Synopsis
data
errors
Package errors provides the error package for Kusto.
Package errors provides the error package for Kusto.
table
Package table contains types that represent the makeup of a Kusto table.
Package table contains types that represent the makeup of a Kusto table.
types
Package types holds Kusto type information that is used to describe what type would be held in a cell based on the column's type setting.
Package types holds Kusto type information that is used to describe what type would be held in a cell based on the column's type setting.
value
Package value holds Kusto data value representations.
Package value holds Kusto data value representations.
Package ingest provides data ingestion from various external sources into Kusto.
Package ingest provides data ingestion from various external sources into Kusto.
internal/conn
Package conn holds a streaming ingest connetion.
Package conn holds a streaming ingest connetion.
internal/gzip
Package gzip provides a streaming object for taking in io.ReadCloser that is being written to and providing an io.ReadCloser that outputs the original content gzip compressed.
Package gzip provides a streaming object for taking in io.ReadCloser that is being written to and providing an io.ReadCloser that outputs the original content gzip compressed.
internal/properties
Package properties provides Kusto REST properties that will need to be serialized and sent to Kusto based upon the type of ingestion we are doing.
Package properties provides Kusto REST properties that will need to be serialized and sent to Kusto based upon the type of ingestion we are doing.
internal/queued
Package filesystem provides a client with the ability to import data into Kusto via a variety of fileystems such as local storage or blobstore.
Package filesystem provides a client with the ability to import data into Kusto via a variety of fileystems such as local storage or blobstore.
internal/resources
Package resources contains objects that are used to gather information about Kusto resources that are used during various ingestion methods.
Package resources contains objects that are used to gather information about Kusto resources that are used during various ingestion methods.
internal
frames/unmarshal
Package unmarshal provides decoding of Kusto row data in a frame into []value.Values representing those rows.
Package unmarshal provides decoding of Kusto row data in a frame into []value.Values representing those rows.
frames/unmarshal/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
frames/v1
Package v1 holds framing information for the v1 REST API.
Package v1 holds framing information for the v1 REST API.
frames/v2
Package v2 holds framing information for the v2 REST API.
Package v2 holds framing information for the v2 REST API.
log
version
Package version keeps the internal version number of the client.
Package version keeps the internal version number of the client.
test
Package unsafe provides methods and types that loosen the native protections of the Kusto package.
Package unsafe provides methods and types that loosen the native protections of the Kusto package.

Jump to

Keyboard shortcuts

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