sqlprovider

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	DB                      *sql.DB
	StatementAttributeName  string
	ParametersAttributeName string
}

func NewProvider

func NewProvider(driverName string, dataSourceName string) (*Provider, error)

func (*Provider) Close

func (p *Provider) Close() error

func (*Provider) NewQuery

func (p *Provider) NewQuery(name string, body hcl.Body, evalCtx *hcl.EvalContext) (provider.Query, error)

type Query

type Query struct {
	Provider  *Provider
	Name      string
	Params    QueryParams
	Statement hcl.Expression
}

func (*Query) Run

func (q *Query) Run(ctx context.Context, evalCtx *hcl.EvalContext) (*provider.QueryResult, error)

func (*Query) RunWithParamters

func (q *Query) RunWithParamters(ctx context.Context, evalCtx *hcl.EvalContext, params []interface{}) (*provider.QueryResult, error)

type QueryParam

type QueryParam struct {
	Name  string
	Index int
	Value hcl.Expression
}

type QueryParams

type QueryParams []QueryParam

func DecodeExpressionToQueryParams

func DecodeExpressionToQueryParams(expr hcl.Expression, evalCtx *hcl.EvalContext) (QueryParams, error)

func (QueryParams) ToInterfaceSlice

func (ps QueryParams) ToInterfaceSlice(evalCtx *hcl.EvalContext) ([]interface{}, error)

Jump to

Keyboard shortcuts

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