Documentation
¶
Overview ¶
Package yqlclient provides YTSaurus YQL client.
Index ¶
- func ReadResult[T any](ctx context.Context, c *Client, queryID ytqueryapi.QueryID, ...) (iterators.Iterator[T], error)
- func YQLQuery[T any](ctx context.Context, c *Client, q string) (iterators.Iterator[T], error)
- type Client
- type ClientOptions
- type Error
- type ExecuteQueryParams
- type ResultFormat
- type YSONFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadResult ¶
func ReadResult[T any](ctx context.Context, c *Client, queryID ytqueryapi.QueryID, format ResultFormat[T]) (iterators.Iterator[T], error)
ReadResult reads result of given query ID.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a YQL client.
func NewClient ¶
func NewClient(proxyURL string, opts ClientOptions) (*Client, error)
NewClient creates new Client.
func (*Client) ExecuteQuery ¶
func (c *Client) ExecuteQuery(ctx context.Context, q string, params ExecuteQueryParams) (queryID ytqueryapi.QueryID, rerr error)
ExecuteQuery starts query and waits for query completion.
Caller may abort the query by canceling the context.
func (*Client) RawClient ¶
func (c *Client) RawClient() *ytqueryapi.Client
RawClient returns raw client.
type ClientOptions ¶
type ClientOptions struct {
// Token to use. If empty, authentication would not be used.
Token string
// Client to use. Defaults to http.DefaultClient.
Client *http.Client
// TracerProvider is a tracer provider. Defaults to otel.GetTracerProvider.
TracerProvider trace.TracerProvider
// MeterProvider is a meter provider. Defaults to otel.GetMeterProvider.
MeterProvider metric.MeterProvider
}
ClientOptions is a Client creation options.
type ExecuteQueryParams ¶
type ExecuteQueryParams struct {
// PollInterval is a query result polling interval. Defaults to 1s.
PollInterval time.Duration
// AbortTimeout sets timeout for aborting query. Defaults to 10s.
AbortTimeout time.Duration
// Engine to run query. Defaults to YQL.
Engine ytqueryapi.Engine
}
ExecuteQueryParams sets ExecuteQuery parameters.
type ResultFormat ¶
type ResultFormat[T any] interface { Format() ytqueryapi.OutputFormat Iter(r io.Reader) (iterators.Iterator[T], error) }
ResultFormat defines result decoder.
type YSONFormat ¶
type YSONFormat[T any] struct{}
YSONFormat decodes result as YSON.
func (YSONFormat[T]) Format ¶
func (YSONFormat[T]) Format() ytqueryapi.OutputFormat
Format implements ResultFormat.
func (YSONFormat[T]) Iter ¶
Iter implements ResultFormat.
Click to show internal directories.
Click to hide internal directories.