engine

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 10 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 GeometryColumnInfo added in v0.2.0

type GeometryColumnInfo struct {
	Name   string `json:"name"`
	SRID   int    `json:"srid"`
	Format string `json:"format"` // "WKB", "GeoJSON", "H3Cell"
}

GeometryColumnInfo holds metadata about a geometry column detected from Arrow schema field metadata or schema-level metadata.

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
	GeometryColumns []GeometryColumnInfo
	Rows            [][]string
	TotalRows       int64
	NumChunks       int
}

QueryResult holds the output of a SQL execution.

func (*QueryResult) AddPreviewRows added in v0.2.0

func (r *QueryResult) AddPreviewRows(rec arrow.RecordBatch, previewLimit int) bool

AddPreviewRows adds rows from a record batch to the result preview. Returns true when the preview limit has been reached.

func (*QueryResult) InitFromSchema added in v0.2.0

func (r *QueryResult) InitFromSchema(schema *arrow.Schema)

InitFromSchema initializes column metadata and detects geometry columns.

Jump to

Keyboard shortcuts

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