sql

package
v0.1.0-rc.11 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Mask = "***"

Mask is the placeholder substituted for any sensitive value.

Variables

This section is empty.

Functions

func ConvertArg

func ConvertArg(value cty.Value) (any, error)

ConvertArg lowers a single cty value into a database/sql parameter value. Null values map to Go nil so drivers bind a SQL NULL.

func ConvertArgs

func ConvertArgs(args []cty.Value) ([]any, error)

ConvertArgs lowers a list of cty values into Go values usable as database/sql parameters. Scalars only: cty lists and objects are rejected in V1 because the standard driver protocol can not bind composite values without provider-specific helpers.

func ConvertRowValue

func ConvertRowValue(value any) (cty.Value, error)

ConvertRowValue normalizes a value returned by database/sql.Rows.Scan into a cty.Value the rest of Tales can match against.

func MaskDSN

func MaskDSN(dsn string) string

MaskDSN replaces credential material in a DSN-like string. It is used only to scrub values before they reach error messages or logs; the original DSN is never copied into Output.Request.

Types

type ConnectionConfig

type ConnectionConfig struct {
	Name   string
	Driver string // alias supplied by the user (postgres / pgx / mysql)
	DSN    string
}

ConnectionConfig is the resolved configuration for one SQL connection.

type Provider

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

Provider executes step "sql" via database/sql. It owns a per-process cache of *sql.DB instances, opened lazily on first use and closed when the runner finishes the suite.

func New

func New() *Provider

New creates an empty SQL provider. Drivers are registered by the package imports.go file (pgx + mysql) at startup.

func (*Provider) Close

func (p *Provider) Close() error

Close releases every cached *sql.DB. The runner calls it once at the end of a suite via the io.Closer type assertion path.

func (*Provider) Execute

func (p *Provider) Execute(ctx context.Context, input provider.Input) (*provider.Output, error)

Execute runs one SQL exec or query as described by input.SQL.

func (*Provider) Inject

func (p *Provider) Inject(name string, db *dbsql.DB)

Inject lets tests bypass driver registration and inject a pre-built *sql.DB. It is exported only for the package's own tests and for runtime wiring; .tales scenarios never reach it directly.

func (*Provider) Type

func (p *Provider) Type() string

Type returns the provider type label "sql".

Jump to

Keyboard shortcuts

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