spi

package
v0.0.0-...-e6c4605 Latest Latest
Warning

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

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

Documentation

Overview

Package spi provides Service Provider Interface types for dialect clause handlers to interact with the parser without circular dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClauseHandler

type ClauseHandler func(p ParserOps) (Node, error)

ClauseHandler parses a dialect-specific clause. Called AFTER the clause keyword has been consumed. Returns the parsed node or an error.

type FromItemHandler

type FromItemHandler func(p ParserOps, sourceTable core.TableRef) (core.TableRef, error)

FromItemHandler parses a dialect-specific FROM clause item (e.g., PIVOT, UNPIVOT). Called AFTER the keyword has been consumed. The sourceTable parameter is the already-parsed left-hand table.

type GroupByAllMarker

type GroupByAllMarker interface {
	IsGroupByAll() bool
}

GroupByAllMarker is an interface to identify GROUP BY ALL markers from dialect handlers. Implement this interface in dialect-specific marker types.

type InfixHandler

type InfixHandler func(p ParserOps, left core.Expr) (core.Expr, error)

InfixHandler parses a dialect-specific infix operator. Called AFTER the operator has been consumed. left is the already-parsed left operand.

type Node

type Node interface{}

Node is the parsed result (opaque to allow returning slices and markers). Handlers can return core.Node implementations, slices, or marker types.

type OrderByAllMarker

type OrderByAllMarker interface {
	IsOrderByAll() bool
	IsDesc() bool
}

OrderByAllMarker is an interface to identify ORDER BY ALL markers from dialect handlers. Implement this interface in dialect-specific marker types.

type ParserOps

type ParserOps interface {
	// Token access
	Token() token.Token
	Peek() token.Token

	// Consumption
	Match(t token.TokenType) bool
	Expect(t token.TokenType) error
	NextToken()
	Check(t token.TokenType) bool

	// Sub-parsers
	ParseExpression() (core.Expr, error)
	ParseExpressionList() ([]core.Expr, error)
	ParseOrderByList() ([]core.OrderByItem, error)
	ParseIdentifier() (string, error)

	// Error handling
	AddError(msg string)
	Position() token.Position
}

ParserOps exposes parser operations to dialect clause handlers. This interface allows dialect-specific code to interact with the parser without creating circular dependencies.

type PrefixHandler

type PrefixHandler func(p ParserOps) (core.Expr, error)

PrefixHandler parses a dialect-specific prefix operator. Called AFTER the operator has been consumed.

type StarModifierHandler

type StarModifierHandler func(p ParserOps) (core.StarModifier, error)

StarModifierHandler parses a dialect-specific star modifier (e.g., EXCLUDE, REPLACE, RENAME). Called AFTER the modifier keyword has been consumed. Returns the parsed modifier or an error.

Jump to

Keyboard shortcuts

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