exec

package
v0.0.0-...-6d74526 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultWaitInterval is a default value of wait interval.
	DefaultWaitInterval = 1000 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CanceledError

type CanceledError struct {
	Query string
	ID    string
}

CanceledError represents an error that a query execution been canceled.

func (*CanceledError) Error

func (e *CanceledError) Error() string

func (*CanceledError) String

func (e *CanceledError) String() string

type Query

type Query struct {
	*QueryConfig
	*Result
	// contains filtered or unexported fields
}

Query represents a query to be executed. Query is NOT goroutine-safe so must be used in a single goroutine.

func NewQuery

func NewQuery(client athenaiface.AthenaAPI, cfg *QueryConfig, query string) *Query

NewQuery creates a new Query struct. `query` string must be a single SQL statement rather than multiple ones joined by semicolons.

func NewQueryFromQx

func NewQueryFromQx(client athenaiface.AthenaAPI, cfg *QueryConfig, qx *athena.QueryExecution) *Query

NewQueryFromQx creates a new Query struct from information about a query execution.

func (*Query) GetResults

func (q *Query) GetResults(ctx context.Context) error

GetResults gets the results of the query execution.

func (*Query) Run

func (q *Query) Run(ctx context.Context) (*Result, error)

Run starts the specified query, waits for it to complete and fetch the results.

func (*Query) Start

func (q *Query) Start(ctx context.Context) error

Start starts the specified query but does not wait for it to complete.

func (*Query) Wait

func (q *Query) Wait(ctx context.Context) error

Wait waits for the query execution until its state has become SUCCEEDED, FAILED or CANCELLED.

If the given Context has been canceled, it calls StopQueryExecution API and tries to cancel the query execution.

func (*Query) WithWaitInterval

func (q *Query) WithWaitInterval(interval time.Duration) *Query

WithWaitInterval sets wait interval to q.

type QueryConfig

type QueryConfig struct {
	Database string
	Location string
	Encrypt  string
	KMS      string // Required only if Encrypt = (SSE_KMS|CSE_KMS)
}

QueryConfig is configurations for query executions.

type Result

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

Result represents results of a query execution. This struct must implement print.Result interface.

func (*Result) Info

func (r *Result) Info() *athena.QueryExecution

Info returns information of a query execution.

func (*Result) Rows

func (r *Result) Rows() [][]string

Rows returns an array of all rows of the result which contain arrays of columns.

Jump to

Keyboard shortcuts

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