queryrunner

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var QueryRunningContextKey contextKey = "__handle_context"

Functions

func Register

func Register(def *QueryRunnerDefinition) error

func RestrictQueryBlock

func RestrictQueryBlock(queryRunnerType string, body hcl.Body) hcl.Diagnostics

func RestrictQueryRunnerBlock

func RestrictQueryRunnerBlock(queryRunnerType string, body hcl.Body) hcl.Diagnostics

func WithQueryRunningContext

func WithQueryRunningContext(ctx context.Context, info *QueryRunningContext) context.Context

Types

type PreparedQuery

type PreparedQuery interface {
	Name() string
	Run(ctx context.Context, data interface{}) (*QueryResult, error)
}

type QueryResult

type QueryResult struct {
	Name    string
	Query   string
	Columns []string
	Rows    [][]string
}

func NewEmptyQueryResult

func NewEmptyQueryResult(name string, query string) *QueryResult

func NewQueryResult

func NewQueryResult(name string, query string, columns []string, rows [][]string) *QueryResult

func NewQueryResultWithJSONLines added in v0.5.0

func NewQueryResultWithJSONLines(name string, query string, lines [][]byte) *QueryResult

func NewQueryResultWithRowsMap added in v0.6.0

func NewQueryResultWithRowsMap(name, query string, columnsMap map[string]int, rowsMap []map[string]interface{}) *QueryResult

func (*QueryResult) ToJSON added in v0.5.0

func (qr *QueryResult) ToJSON() string

func (*QueryResult) ToTable

func (qr *QueryResult) ToTable(optFns ...func(*tablewriter.Table)) string

func (*QueryResult) ToVertical

func (qr *QueryResult) ToVertical() string

type QueryRunner

type QueryRunner interface {
	Prepare(name string, body hcl.Body, ctx *hcl.EvalContext) (PreparedQuery, hcl.Diagnostics)
}

func NewQueryRunner

func NewQueryRunner(queryRunnerType string, name string, body hcl.Body, ctx *hcl.EvalContext) (QueryRunner, hcl.Diagnostics)

type QueryRunnerDefinition

type QueryRunnerDefinition struct {
	TypeName                     string
	RestrictQueryRunnerBlockFunc func(body hcl.Body) hcl.Diagnostics
	RestrictQueryBlockFunc       func(body hcl.Body) hcl.Diagnostics
	BuildQueryRunnerFunc         func(name string, body hcl.Body, ctx *hcl.EvalContext) (QueryRunner, hcl.Diagnostics)
}

type QueryRunningContext

type QueryRunningContext struct {
	ReqID uint64
	// contains filtered or unexported fields
}

func GetQueryRunningContext

func GetQueryRunningContext(ctx context.Context) (*QueryRunningContext, bool)

func NewQueryRunningContext

func NewQueryRunningContext(sqsClient *sqs.Client, queueURL string, reqID uint64, message *events.SQSMessage) *QueryRunningContext

func (*QueryRunningContext) ChangeSQSMessageVisibilityTimeout

func (hctx *QueryRunningContext) ChangeSQSMessageVisibilityTimeout(ctx context.Context, visibilityTimeout time.Duration) error

type Waiter

type Waiter struct {
	StartTime time.Time
	MinDelay  time.Duration
	MaxDelay  time.Duration
	Timeout   time.Duration
	Jitter    time.Duration
	// contains filtered or unexported fields
}

func (*Waiter) Continue

func (w *Waiter) Continue(ctx context.Context) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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