api

package module
v1.0.0-alpha.13 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

README

Universal Ferret API

Documentation

Overview

Package api defines implementation-independent contracts for compiling, executing, and debugging Ferret queries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

type Location = source.Location

Location represents the location of a specific point in a source file, including the file name and position.

type OptimizationLevel

type OptimizationLevel int
const (
	OptimizationNone OptimizationLevel = iota
	OptimizationBasic
	OptimizationFull
	OptimizationAggressive
)

type Output

type Output = result.Output

Output is the encoded result returned from session or engine execution.

type Plan

type Plan interface {
	io.Closer
	Params() []string
	NewSession(ctx context.Context, opts ...SessionOption) (Session, error)
	NewDebugSession(ctx context.Context, opts ...SessionOption) (debugger.Session, error)
}

type PlanOption

type PlanOption = func(PlanOptions) error

func WithOptimizationLevel

func WithOptimizationLevel(level OptimizationLevel) PlanOption

WithOptimizationLevel sets the optimization level for the execution plan.

type PlanOptions

type PlanOptions interface {
	SetOptimizationLevel(OptimizationLevel) error
}

type Position

type Position = source.Position

Position represents a specific point in a source file, defined by line and column numbers.

type Range

type Range = source.Range

Range represents a range of characters in a source file, including the location and span.

type Runtime

type Runtime interface {
	io.Closer
	Run(ctx context.Context, src Source, opts ...SessionOption) (Output, error)
	Compile(ctx context.Context, src Source, opts ...PlanOption) (Plan, error)
	CompileDebug(ctx context.Context, src Source, opts ...PlanOption) (Plan, error)
}

type Session

type Session interface {
	io.Closer
	Run(c context.Context) (Output, error)
}

type SessionOption

type SessionOption = func(SessionOptions) error

func WithFSRoot

func WithFSRoot(root string) SessionOption

WithFSRoot selects the rooted filesystem used by one execution session. The runtime defines path validation and owns any filesystem resources created for the session.

func WithOutputContentType

func WithOutputContentType(contentType string) SessionOption

WithOutputContentType selects the output codec content type for session results.

func WithParam

func WithParam(key string, value any) SessionOption

WithParam sets a session parameter for the execution.

func WithParams

func WithParams(params map[string]any) SessionOption

WithParams merges the provided parameter map into the session environment, overriding existing keys while preserving any other previously defined parameters.

type SessionOptions

type SessionOptions interface {
	SetParam(string, any) error
	SetParams(map[string]any) error
	SetOutputContentType(string) error
	SetFSRoot(string) error
}

type Source

type Source = source.Source

Source represents the input data for a Ferret query.

func NewAnonymousSource

func NewAnonymousSource(content string) Source

NewAnonymousSource creates a new anonymous Source instance with the given content.

func NewSource

func NewSource(name, content string) Source

NewSource creates a new Source instance with the given name and content.

type Span

type Span = source.Span

Span represents a range of characters in a source file, defined by start and end positions.

Directories

Path Synopsis
Package debugger defines portable contracts and values for controlling and inspecting Ferret debug sessions, including events, breakpoints, frames, and values.
Package debugger defines portable contracts and values for controlling and inspecting Ferret debug sessions, including events, breakpoints, frames, and values.
Package diagnostics defines the portable structured reporting model shared by Ferret runtimes and tooling.
Package diagnostics defines the portable structured reporting model shared by Ferret runtimes and tooling.
Package result defines portable encoded outputs returned by Ferret query execution.
Package result defines portable encoded outputs returned by Ferret query execution.
Package source defines portable Ferret source inputs and coordinates.
Package source defines portable Ferret source inputs and coordinates.

Jump to

Keyboard shortcuts

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