duckdb

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package duckdb provides the DuckDB database engine implementation.

DuckDB is an in-process analytical SQL database with a type system that is close to standard SQL and PostgreSQL. This engine:

  • Reuses the SQLite schema parser for DDL (CREATE TABLE / CREATE INDEX). DuckDB DDL is a superset of standard SQL, and the SQLite parser handles the common subset correctly. Native DuckDB types that the SQLite parser cannot tokenize (e.g. INTEGER[], STRUCT, MAP) will fall through to the "any" type-mapper fallback — a documented v1 limitation.

  • Does NOT require a live DuckDB connection for code generation; all type mapping and DDL parsing is static. The "default driver" field records the community CGO binding (github.com/marcboeker/go-duckdb) for reference, but no pure-Go driver exists at the time of writing.

Package duckdb provides the DuckDB database engine implementation.

Type-mapping notes:

  • INTEGER/INT/INT4 → int32 (DuckDB's 4-byte integer; contrast with SQLite where all INTEGERs are int64 due to storage affinity).
  • BIGINT/HUGEINT/INT8 → int64.
  • DECIMAL/NUMERIC → string (safe lossless default; use custom_types to override).
  • JSON → json.RawMessage (requires "encoding/json").
  • UUID → string (use custom_types to swap in e.g. github.com/google/uuid.UUID).
  • Array types (e.g. INTEGER[]) are not parsed by the reused SQLite DDL parser and will fall through to the "any" fallback. This is a documented v1 limitation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts engine.Options) (engine.Engine, error)

New creates a new DuckDB engine instance.

Types

type Engine

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

Engine implements the engine.Engine interface for DuckDB.

func (*Engine) BulkInsertStrategy

func (e *Engine) BulkInsertStrategy() engine.BulkInsertStrategy

BulkInsertStrategy returns the :copyfrom strategy for DuckDB. DuckDB accepts multi-row VALUES statements with "?" positional parameters (via the database/sql interface).

func (*Engine) ConnectionPool

func (e *Engine) ConnectionPool() engine.ConnectionPoolConfig

ConnectionPool returns recommended connection pool settings for DuckDB. DuckDB in embedded mode benefits from a small pool; remote-mode users should override these settings based on their deployment.

func (*Engine) DefaultDriver

func (e *Engine) DefaultDriver() string

DefaultDriver returns the reference Go driver import path for DuckDB.

NOTE: github.com/marcboeker/go-duckdb requires CGO. There is no pure-Go DuckDB driver at the time of writing, so code-generation verification is static-only (no live connection tests).

func (*Engine) IsolationLevels

func (e *Engine) IsolationLevels() (supported []engine.IsolationLevel, defaultLevel engine.IsolationLevel)

IsolationLevels returns the supported transaction isolation levels for DuckDB. DuckDB uses MVCC and supports SERIALIZABLE as its primary isolation level.

func (*Engine) Name

func (e *Engine) Name() string

Name returns the engine identifier.

func (*Engine) QueryHints

func (e *Engine) QueryHints() []engine.QueryHint

QueryHints returns available query hints for DuckDB. DuckDB does not expose SQL-level query hints to users.

func (*Engine) SQLGenerator

func (e *Engine) SQLGenerator() engine.SQLGenerator

SQLGenerator returns the DuckDB SQL generator.

func (*Engine) SchemaParser

func (e *Engine) SchemaParser() schemaparser.SchemaParser

SchemaParser returns the schema parser. DuckDB reuses the SQLite DDL parser for the common DDL subset.

func (*Engine) SupportsFeature

func (e *Engine) SupportsFeature(feature engine.Feature) bool

SupportsFeature reports whether DuckDB supports a specific feature.

func (*Engine) TypeMapper

func (e *Engine) TypeMapper() engine.TypeMapper

TypeMapper returns the DuckDB type mapper.

Jump to

Keyboard shortcuts

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