impls

package
v0.0.0-...-b19370d Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyExecutionContext = NewExecutionContext(NewCatalogEmptySet())

Functions

This section is empty.

Types

type Aggregate

type Aggregate interface {
	Callable
	Step(ctx ExecutionContext, state any, args []any) (any, error)
	Done(ctx ExecutionContext, state any) (any, error)
}

type AggregateExpression

type AggregateExpression interface {
	Step(ctx ExecutionContext, row rows.Row) error
	Done(ctx ExecutionContext) (any, error)
}

type BaseIndex

type BaseIndex interface {
	Name() string
	Unwrap() BaseIndex
	UniqueOn() []fields.Field
	Filter() Expression
	Insert(row rows.Row) error
	Delete(row rows.Row) error
}

type Callable

type Callable interface {
	Name() string
	ParamTypes() []types.Type
	ReturnType() types.Type
	ValidateArgTypes(argTypes []types.Type) error
	RefineArgValues(args []any) ([]any, error)
}

func NewCallable

func NewCallable(
	name string,
	paramTypes []types.Type,
	returnType types.Type,
) Callable

type CatalogSet

type CatalogSet struct {
	Tables     *catalog.Catalog[Table]
	Sequences  *catalog.Catalog[Sequence]
	Functions  *catalog.Catalog[Function]
	Aggregates *catalog.Catalog[Aggregate]
}

func NewCatalogEmptySet

func NewCatalogEmptySet() CatalogSet

func NewCatalogSet

func NewCatalogSet(
	tables *catalog.Catalog[Table],
	sequences *catalog.Catalog[Sequence],
	functions *catalog.Catalog[Function],
	aggregates *catalog.Catalog[Aggregate],
) CatalogSet

type Cataloger

type Cataloger interface {
	Catalog() CatalogSet
}

type Constraint

type Constraint interface {
	Name() string
	Check(ctx ExecutionContext, row rows.Row) error
}

type ExecutionContext

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

func NewExecutionContext

func NewExecutionContext(catalog CatalogSet) ExecutionContext

func (ExecutionContext) AddOuterRow

func (c ExecutionContext) AddOuterRow(row rows.Row) ExecutionContext

func (ExecutionContext) Catalog

func (c ExecutionContext) Catalog() CatalogSet

func (ExecutionContext) Log

func (c ExecutionContext) Log(format string, args ...interface{})

func (ExecutionContext) OptimizationContext

func (c ExecutionContext) OptimizationContext() OptimizationContext

func (ExecutionContext) OuterRow

func (c ExecutionContext) OuterRow() rows.Row

func (ExecutionContext) WithDebug

func (c ExecutionContext) WithDebug() ExecutionContext

type Expression

type Expression interface {
	fmt.Stringer

	Resolve(ctx ExpressionResolutionContext) error
	Type() types.Type
	Equal(other Expression) bool
	Children() []Expression
	Fold() Expression
	Map(f func(Expression) (Expression, error)) (Expression, error)
	ValueFrom(cts ExecutionContext, row rows.Row) (any, error)
}

type ExpressionResolutionContext

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

func NewExpressionResolutionContext

func NewExpressionResolutionContext(catalog CatalogSet, allowAggregateFunctions bool) ExpressionResolutionContext

func (ExpressionResolutionContext) AllowAggregateFunctions

func (ctx ExpressionResolutionContext) AllowAggregateFunctions() bool

func (ExpressionResolutionContext) Catalog

type ExpressionWithDirection

type ExpressionWithDirection struct {
	Expression Expression
	Reverse    bool
}

func (ExpressionWithDirection) Fold

type Function

type Function interface {
	Callable
	Invoke(ctx ExecutionContext, args []any) (any, error)
}

type Index

type Index[O ScanOptions] interface {
	BaseIndex

	Description(opts O) string
	Condition(opts O) Expression
	Ordering(opts O) OrderExpression
	Scanner(ctx ExecutionContext, opts O) (scan.TIDScanner, error)
}

type NodeResolutionContext

type NodeResolutionContext struct {
	Scopes []Scope
	// contains filtered or unexported fields
}

func NewNodeResolutionContext

func NewNodeResolutionContext(catalog CatalogSet) *NodeResolutionContext

func (*NodeResolutionContext) Bind

func (ctx *NodeResolutionContext) Bind(fields []fields.Field)

func (*NodeResolutionContext) Catalog

func (ctx *NodeResolutionContext) Catalog() CatalogSet

func (*NodeResolutionContext) CurrentScope

func (ctx *NodeResolutionContext) CurrentScope() *Scope

func (*NodeResolutionContext) ExpressionResolutionContext

func (ctx *NodeResolutionContext) ExpressionResolutionContext(allowAggregateFunctions bool) ExpressionResolutionContext

func (*NodeResolutionContext) Lookup

func (ctx *NodeResolutionContext) Lookup(relationName, name string) (fields.Field, error)

func (*NodeResolutionContext) PopScope

func (ctx *NodeResolutionContext) PopScope()

func (*NodeResolutionContext) PushScope

func (ctx *NodeResolutionContext) PushScope()

func (*NodeResolutionContext) WithScope

func (ctx *NodeResolutionContext) WithScope(f func() error) error

type OptimizationContext

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

func NewOptimizationContext

func NewOptimizationContext(catalog CatalogSet) OptimizationContext

func (OptimizationContext) AddOuterFields

func (c OptimizationContext) AddOuterFields(fields []fields.Field) OptimizationContext

func (OptimizationContext) Catalog

func (c OptimizationContext) Catalog() CatalogSet

func (OptimizationContext) OuterFields

func (c OptimizationContext) OuterFields() []fields.Field

type OrderExpression

type OrderExpression interface {
	Expressions() []ExpressionWithDirection
	Fold() OrderExpression
	Map(f func(e Expression) (Expression, error)) (OrderExpression, error)
}

type ScanOptions

type ScanOptions any

type Scope

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

type Sequence

type Sequence interface {
	Name() string
	Next() (int64, error)
	Set(value int64) error
	Value() int64
}

type Table

type Table interface {
	Name() string
	Indexes() []BaseIndex
	Fields() []TableField
	Size() int
	TIDs() []int64
	Row(tid int64) (rows.Row, bool)
	SetPrimaryKey(index BaseIndex) error
	AddIndex(index BaseIndex) error
	AddConstraint(ctx ExecutionContext, constraint Constraint) error
	Insert(ctx ExecutionContext, row rows.Row) (_ rows.Row, err error)
	Delete(row rows.Row) (rows.Row, bool, error)
}

type TableField

type TableField struct {
	fields.Field
	// contains filtered or unexported fields
}

func NewTableField

func NewTableField(relationName, name string, typ types.Type, internalFieldType fields.InternalFieldType) TableField

func NewTableFieldFromField

func NewTableFieldFromField(field fields.Field) TableField

func (TableField) Default

func (f TableField) Default(ctx ExecutionContext) (any, error)

func (TableField) Nullable

func (f TableField) Nullable() bool

func (TableField) WithDefault

func (f TableField) WithDefault(defaultExpression Expression) TableField

func (TableField) WithNonNullable

func (f TableField) WithNonNullable() TableField

TODO - make actual constraint?

func (TableField) WithRelationName

func (f TableField) WithRelationName(relationName string) TableField

func (TableField) WithType

func (f TableField) WithType(typ types.Type) TableField

Jump to

Keyboard shortcuts

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