Documentation
¶
Index ¶
Constants ¶
const Mask = "***"
Mask is the placeholder substituted for any sensitive value.
Variables ¶
This section is empty.
Functions ¶
func ConvertArg ¶
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 ¶
ConvertArgs lowers a list of cty values into Go values usable as database/sql parameters. Scalars bind directly; a nested list becomes a ListArg, which the provider later expands into a placeholder run. Objects and maps are still rejected: no composite binding exists for them.
func ConvertRowValue ¶
ConvertRowValue normalizes a value returned by database/sql.Rows.Scan into a cty.Value the rest of Tales can match against.
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 ListArg ¶
type ListArg []any
ListArg marks an argument written as a nested list in .tales (args = [[1, 2, 3]]). The provider expands the placeholder bound to it into a run of placeholders (IN ($1,$2,$3) / IN (?,?,?)) and flattens the values before binding them, because no driver protocol binds a composite value to a single placeholder. Elements are already lowered to database/sql parameter values.
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 ¶
Close releases every cached *sql.DB. The runner calls it once at the end of a suite via the io.Closer type assertion path.