Documentation ¶
Index ¶
- func GetRequestID(ctx context.Context) string
- func Register(def *QueryRunnerDefinition) error
- func WithRequestID(ctx context.Context, requestID string) context.Context
- func WithTimeoutExtender(ctx context.Context, extender TimeoutExtender) context.Context
- type PreparedQueries
- type PreparedQuery
- type QueryBase
- func (q *QueryBase) Body() hcl.Body
- func (q *QueryBase) DecodeBody(body hcl.Body, ctx *hcl.EvalContext, queryRunners QueryRunners) (PreparedQuery, hcl.Diagnostics)
- func (q *QueryBase) Description() string
- func (q *QueryBase) Name() string
- func (q *QueryBase) NewEvalContext(variables map[string]cty.Value, functions map[string]function.Function) *hcl.EvalContext
- func (q *QueryBase) Remain() hcl.Body
- func (q *QueryBase) Runner() QueryRunner
- func (q *QueryBase) RunnerType() string
- type QueryResult
- func NewEmptyQueryResult(name string, query string) *QueryResult
- func NewQueryResult(name string, query string, columns []string, rows [][]string) *QueryResult
- func NewQueryResultWithJSONLines(name string, query string, lines [][]byte) *QueryResult
- func NewQueryResultWithRowsMap(name, query string, columnsMap map[string]int, ...) *QueryResult
- func (qr *QueryResult) MarshalCTYValue() cty.Value
- func (qr *QueryResult) MarshalJSON() ([]byte, error)
- func (qr *QueryResult) ToBorderlessTable() string
- func (qr *QueryResult) ToJSONLines() string
- func (qr *QueryResult) ToMarkdownTable() string
- func (qr *QueryResult) ToTable(optFns ...func(*tablewriter.Table)) string
- func (qr *QueryResult) ToVertical() string
- type QueryResults
- type QueryRunner
- type QueryRunnerDefinition
- type QueryRunners
- type TimeoutExtender
- type TimeoutExtenderFunc
- type Waiter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRequestID ¶
func Register ¶
func Register(def *QueryRunnerDefinition) error
func WithTimeoutExtender ¶
func WithTimeoutExtender(ctx context.Context, extender TimeoutExtender) context.Context
Types ¶
type PreparedQueries ¶
type PreparedQueries []PreparedQuery
func DecodeBody ¶
func DecodeBody(body hcl.Body, ctx *hcl.EvalContext) (PreparedQueries, hcl.Body, hcl.Diagnostics)
func (*PreparedQueries) DecodeBody ¶
func (queries *PreparedQueries) DecodeBody(body hcl.Body, ctx *hcl.EvalContext) hcl.Diagnostics
func (PreparedQueries) Get ¶
func (queries PreparedQueries) Get(name string) (PreparedQuery, bool)
type PreparedQuery ¶
type PreparedQuery interface { Name() string Description() string RunnerType() string Run(ctx context.Context, variables map[string]cty.Value, functions map[string]function.Function) (*QueryResult, error) }
func TraversalQuery ¶
func TraversalQuery(traversal hcl.Traversal, queries PreparedQueries) (PreparedQuery, error)
type QueryBase ¶
type QueryBase struct {
// contains filtered or unexported fields
}
func (*QueryBase) DecodeBody ¶
func (q *QueryBase) DecodeBody(body hcl.Body, ctx *hcl.EvalContext, queryRunners QueryRunners) (PreparedQuery, hcl.Diagnostics)
func (*QueryBase) Description ¶
func (*QueryBase) NewEvalContext ¶
func (*QueryBase) Runner ¶
func (q *QueryBase) Runner() QueryRunner
func (*QueryBase) RunnerType ¶
type QueryResult ¶
func NewEmptyQueryResult ¶
func NewEmptyQueryResult(name string, query string) *QueryResult
func NewQueryResult ¶
func NewQueryResult(name string, query string, columns []string, rows [][]string) *QueryResult
func NewQueryResultWithJSONLines ¶
func NewQueryResultWithJSONLines(name string, query string, lines [][]byte) *QueryResult
func NewQueryResultWithRowsMap ¶
func NewQueryResultWithRowsMap(name, query string, columnsMap map[string]int, rowsMap []map[string]interface{}) *QueryResult
func (*QueryResult) MarshalCTYValue ¶
func (qr *QueryResult) MarshalCTYValue() cty.Value
func (*QueryResult) MarshalJSON ¶
func (qr *QueryResult) MarshalJSON() ([]byte, error)
func (*QueryResult) ToBorderlessTable ¶
func (qr *QueryResult) ToBorderlessTable() string
func (*QueryResult) ToJSONLines ¶
func (qr *QueryResult) ToJSONLines() string
func (*QueryResult) ToMarkdownTable ¶
func (qr *QueryResult) ToMarkdownTable() string
func (*QueryResult) ToTable ¶
func (qr *QueryResult) ToTable(optFns ...func(*tablewriter.Table)) string
func (*QueryResult) ToVertical ¶
func (qr *QueryResult) ToVertical() string
type QueryResults ¶
type QueryResults []*QueryResult
func (QueryResults) MarshalJSON ¶
func (qrs QueryResults) MarshalJSON() ([]byte, error)
type QueryRunner ¶
type QueryRunner interface { Name() string Type() string Prepare(base *QueryBase) (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 BuildQueryRunnerFunc func(name string, body hcl.Body, ctx *hcl.EvalContext) (QueryRunner, hcl.Diagnostics) }
type QueryRunners ¶
type QueryRunners []QueryRunner
func (QueryRunners) Get ¶
func (runners QueryRunners) Get(queryRunnerType string, name string) (QueryRunner, bool)
type TimeoutExtender ¶
func GetTimeoutExtender ¶
func GetTimeoutExtender(ctx context.Context) TimeoutExtender
type TimeoutExtenderFunc ¶
func (TimeoutExtenderFunc) ExtendTimeout ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.