Documentation
¶
Overview ¶
Package database provides a connector that owns a database/sql connection pool. A sql block binds to it by name and runs statements through its DB(); the connector opens the pool on Start and closes it on Stop. One connector type serves both flavors, selected by the "driver" setting: "postgres" (jackc/pgx) or "sqlite" (modernc.org/sqlite). Both are pure Go, so no CGO toolchain is needed.
This file provides the "sql" block: a processor that runs a SQL statement against this database connector and folds the result into the message body. In query mode (the default) the body becomes an array of row objects, or a single object when "single" is set; in exec mode the body becomes {"rowsAffected": N}. Bind parameters come from CEL expressions evaluated against the message.
Placeholder style is the driver's own: $1, $2 for Postgres and ? for SQLite.
The block lives in the connector's package: importing the connector registers the block too, and it binds to the connector by concrete type.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector is a configured database connection pool that flows' sql blocks run statements through. The pool is opened on Start and closed on Stop; a *sql.DB is safe for concurrent use, matching the shared-connector contract.
func (*Connector) DB ¶
DB returns the connection pool. It is the capability a sql block binds to by referencing this connector by name.