engine

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnMeta

type ColumnMeta struct {
	Name string
	Type string
}

ColumnMeta holds metadata for a single result column.

type Engine

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

Engine executes SQL queries via DuckDB and returns Arrow results.

func NewEngine

func NewEngine(connector *duckdb.Connector) *Engine

NewEngine creates a new execution engine from a DuckDB connector.

func (*Engine) Close

func (e *Engine) Close() error

Close closes the engine (no-op, connector is managed externally).

func (*Engine) Execute

func (e *Engine) Execute(ctx context.Context, query string) (array.RecordReader, error)

Execute runs a SQL query and returns an Arrow RecordReader. The caller must call Release() on the returned reader, which also closes the underlying DuckDB connection.

type Introspector added in v0.1.2

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

Introspector executes DuckDB system queries for metadata introspection.

func NewIntrospector added in v0.1.2

func NewIntrospector(eng *Engine, sessionID string) *Introspector

NewIntrospector creates a new introspector wrapping the given engine.

func (*Introspector) Query added in v0.1.2

func (i *Introspector) Query(ctx context.Context, typ, database, schema, table string) (any, error)

Query executes an introspection query by type with optional filters.

type QueryResult

type QueryResult struct {
	QueryID   string
	Columns   []ColumnMeta
	Rows      [][]string
	TotalRows int64
	NumChunks int
}

QueryResult holds the output of a SQL execution.

func BuildPreviewFromReader added in v0.1.1

func BuildPreviewFromReader(
	reader array.RecordReader,
	previewLimit int,
	onBatch func(rec arrow.Record) error,
) (*QueryResult, error)

BuildPreviewFromReader reads record batches, builds preview rows, and streams each batch to the provided callback without accumulating all records in memory.

Jump to

Keyboard shortcuts

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