Documentation
¶
Overview ¶
Package dalgo2duckdb adapts embedded DuckDB to DALgo using dalgo2sql, following the composition used by dalgo2sqlite. DuckDB requires cgo.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
Database embeds the DALgo SQL adapter and owns its connection pool.
func NewDatabase ¶
NewDatabase opens a DuckDB file; an empty path creates an in-memory database.
func NewDatabaseWithOptions ¶
func NewDatabaseWithOptions(path string, schema dal.Schema, opts dalgo2sql.DbOptions) (*Database, error)
NewDatabaseWithOptions supplies DALgo schema and SQL adapter options.
func NewReadOnlyDatabase ¶
NewReadOnlyDatabase starts a read-only transaction on every physical connection, including replacements after cancellation. Files must use a DSN containing access_mode=read_only; an empty DSN creates an in-memory session. Read-only transactions prevent database writes, but SELECTs can still read external files and URLs. This constructor does not restrict statements sent through the embedded dal.DB or SQLDB. Call ValidateReadQuery before executing untrusted SQL to require exactly one SELECT; resource access requires a separate operator-level authorization decision.
func (*Database) SQLDB ¶
SQLDB returns the underlying pool, for DuckDB-native operations such as COPY.
func (*Database) ValidateReadQuery ¶
ValidateReadQuery asks DuckDB to parse exactly one SELECT without executing preceding statements. Deliberately use the driver's legacy Prepare method: PrepareContext executes all but the last statement of a multi-statement input.