Help us shape the future of Go! Take the 2026 Go Developer Survey

handlers

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigTypes added in v1.1.0

func ConfigTypes() []string

ConfigTypes lists the handler names a config may write, sorted. Kinds returns the registry's short names; these are the long ones users type.

The generated config schema builds its handler enum from this, so a handler the engine can build is always one the schema accepts.

func Kinds added in v1.1.0

func Kinds() []string

Kinds lists every handler type the engine can build, sorted. The registry's short names, not the config's.

func New

func New(conn adbc.Connection, c config.Handler, l *zap.Logger) (core.Handler, error)

Types

type InferredDiskBatchHandler

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

InferredDiskBatchHandler buffers a batch of JSON messages to a file and lets DuckDB infer the schema, rather than holding the batch in memory.

It follows the Python handler step for step: the batch file is loaded with read_json_auto into a `batch` table, the user SQL is run through COPY into an output file, and that file is read back as the result. The `batch` table is dropped after every invoke, so the next batch re-creates it against whatever schema its own messages imply.

func NewInferredDiskBatchHandler

func NewInferredDiskBatchHandler(
	conn adbc.Connection,
	sql string,
	cacheDir string,
	opts ...InferredDiskBatchHandlerOption,
) (*InferredDiskBatchHandler, error)

func (*InferredDiskBatchHandler) Close

func (h *InferredDiskBatchHandler) Close() error

Close removes the staged files. The batch file grows with the batch size, so leaving it behind after shutdown wastes disk until the next run.

func (*InferredDiskBatchHandler) Init

Init truncates the batch file, so a batch never inherits rows from the previous one, and clears any `batch` table left behind on the connection.

func (*InferredDiskBatchHandler) Invoke

func (*InferredDiskBatchHandler) RowsRead added in v1.1.0

func (h *InferredDiskBatchHandler) RowsRead() int64

RowsRead reports the rows the last Invoke loaded into the batch table.

func (*InferredDiskBatchHandler) Write

func (h *InferredDiskBatchHandler) Write(r []byte) error

type InferredDiskBatchHandlerOption

type InferredDiskBatchHandlerOption func(*InferredDiskBatchHandler)

func InferredDiskBatchWithLogger

func InferredDiskBatchWithLogger(l *zap.Logger) InferredDiskBatchHandlerOption

type InferredMemBatchHandler

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

InferredMemBatchHandler buffers a batch of JSON messages in memory and infers the Arrow schema from the messages themselves, rather than requiring a pre-declared table.

Schema inference follows pyarrow.Table.from_pylist, which the Python engine uses: the column set and their order come from the first message, types are promoted across the batch, and a value that cannot be promoted fails the batch rather than being silently nulled.

func NewInferredMemBatchHandler

func NewInferredMemBatchHandler(
	conn adbc.Connection,
	sql string,
	opts ...InferredMemBatchHandlerOption,
) (*InferredMemBatchHandler, error)

func (*InferredMemBatchHandler) Init

func (*InferredMemBatchHandler) Invoke

func (*InferredMemBatchHandler) RowsRead added in v1.1.0

func (h *InferredMemBatchHandler) RowsRead() int64

RowsRead reports the rows the last Invoke ingested into the batch table.

func (*InferredMemBatchHandler) Write

func (h *InferredMemBatchHandler) Write(r []byte) error

func (*InferredMemBatchHandler) WriteMessage

func (h *InferredMemBatchHandler) WriteMessage(msg core.Message) error

WriteMessage buffers a message along with its source metadata, which Invoke exposes as kafka_topic / kafka_partition / kafka_offset columns.

type InferredMemBatchHandlerOption

type InferredMemBatchHandlerOption func(*InferredMemBatchHandler)

func InferredMemBatchWithLogger

func InferredMemBatchWithLogger(l *zap.Logger) InferredMemBatchHandlerOption

type Noop

type Noop struct{}

func (Noop) Init

func (n Noop) Init() error

func (Noop) Invoke

func (n Noop) Invoke() (*arrow.Table, error)

func (Noop) Write

func (n Noop) Write(msg []byte) error

type StructuredBatchHandler

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

func NewStructuredBatchHandler

func NewStructuredBatchHandler(
	conn adbc.Connection,
	sql string,
	tableName string,
	schema *arrow.Schema,
	opts ...StructuredBatchHandlerOption,
) (*StructuredBatchHandler, error)

func (*StructuredBatchHandler) Init

func (*StructuredBatchHandler) Invoke

func (*StructuredBatchHandler) RowsRead added in v1.1.0

func (h *StructuredBatchHandler) RowsRead() int64

RowsRead reports the rows the last Invoke ingested into the batch table.

func (*StructuredBatchHandler) Write

func (h *StructuredBatchHandler) Write(r []byte) error

type StructuredBatchHandlerOption

type StructuredBatchHandlerOption func(*StructuredBatchHandler)

func StructuredBatchWithLogger

func StructuredBatchWithLogger(l *zap.Logger) StructuredBatchHandlerOption

Jump to

Keyboard shortcuts

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