Documentation ¶
Index ¶
- func RegisterProvider[T Provider](typeName string, factory GenericProviderFactory[T])
- func RegisterProviderWithError[T Provider](typeName string, factory GenericProviderFactory[T]) error
- func UnregisterProvider(typeName string)
- func WithFunctions(evalCtx *hcl.EvalContext) *hcl.EvalContext
- func WithQury(evalCtx *hcl.EvalContext, variables *EvalContextQueryVariables) (*hcl.EvalContext, error)
- type EvalContextQueryVariables
- type GenericProviderFactory
- type Provider
- type ProviderFactory
- type ProviderParameter
- type ProviderParameters
- type Query
- type QueryResult
- func NewQueryResult(name string, query string, params []interface{}, columns []string, ...) *QueryResult
- func NewQueryResultWithJSONLines(name string, query string, params []interface{}, ...) *QueryResult
- func NewQueryResultWithSQLRows(name string, query string, params []interface{}, rows *sql.Rows) (*QueryResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterProvider ¶
func RegisterProvider[T Provider](typeName string, factory GenericProviderFactory[T])
func RegisterProviderWithError ¶
func RegisterProviderWithError[T Provider](typeName string, factory GenericProviderFactory[T]) error
func UnregisterProvider ¶
func UnregisterProvider(typeName string)
func WithFunctions ¶
func WithFunctions(evalCtx *hcl.EvalContext) *hcl.EvalContext
func WithQury ¶
func WithQury(evalCtx *hcl.EvalContext, variables *EvalContextQueryVariables) (*hcl.EvalContext, error)
Types ¶
type EvalContextQueryVariables ¶
type EvalContextQueryVariables struct { FQN string `cty:"fqn"` Status string `cty:"status"` Error string `cty:"error"` Result *QueryResult `cty:"result"` }
type GenericProviderFactory ¶
type GenericProviderFactory[T Provider] func(*ProviderParameter) (T, error)
type Provider ¶
type Provider interface {
NewQuery(name string, body hcl.Body, evalCtx *hcl.EvalContext) (Query, error)
}
func NewProvider ¶
func NewProvider(param *ProviderParameter) (Provider, error)
type ProviderFactory ¶
type ProviderFactory func(*ProviderParameter) (Provider, error)
type ProviderParameter ¶
type ProviderParameter struct { Type string Name string Params json.RawMessage // contains filtered or unexported fields }
func (*ProviderParameter) SetParams ¶
func (p *ProviderParameter) SetParams(params map[string]cty.Value) error
func (*ProviderParameter) String ¶
func (p *ProviderParameter) String() string
type ProviderParameters ¶
type ProviderParameters []*ProviderParameter
func (ProviderParameters) MarshalCTYValue ¶
func (p ProviderParameters) MarshalCTYValue() (cty.Value, error)
type Query ¶
type Query interface {
Run(ctx context.Context, evalCtx *hcl.EvalContext) (*QueryResult, error)
}
type QueryResult ¶
type QueryResult struct { Name string `cty:"name" json:"name"` Query string `cty:"query" json:"query"` Params []interface{} `cty:"params" json:"params,omitempty"` Columns []string `cty:"columns" json:"columns"` Rows [][]json.RawMessage `cty:"rows" json:"rows"` }
func NewQueryResult ¶
func NewQueryResult(name string, query string, params []interface{}, columns []string, rows [][]json.RawMessage) *QueryResult
func NewQueryResultWithJSONLines ¶
func NewQueryResultWithJSONLines(name string, query string, params []interface{}, lines ...map[string]json.RawMessage) *QueryResult
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
Click to show internal directories.
Click to hide internal directories.