celprovider

package
v3.8.8 Latest Latest
Warning

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

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

Documentation

Overview

Package celprovider provides the shared cel-go types.Provider implementation embedded by the flat (non-nested-schema) SQL dialect type providers.

The MySQL, SQLite, DuckDB, BigQuery and Spark providers previously each reimplemented the same types.Provider boilerplate over a map[string]Schema, differing only in their type-name → CEL mapping. Base centralises that boilerplate; a dialect embeds Base, supplies its Mapper and LoadTableSchema, and overrides Close only if it owns a connection.

The PostgreSQL provider (pg) is intentionally not built on Base: it resolves nested/composite schemas through a dotted-path lookup and owns a connection pool, so it keeps its own implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	// Schemas holds the table schemas known to the provider, keyed by table name.
	Schemas map[string]schema.Schema
	// Mapper converts a field schema to its CEL expression type.
	Mapper TypeMapper
}

Base implements the portion of cel-go's types.Provider shared by the flat dialect type providers. Embed it and set Schemas and Mapper at construction.

func (*Base) Close

func (b *Base) Close()

Close is a no-op. Providers that own a connection override it.

func (*Base) EnumValue

func (b *Base) EnumValue(_ string) ref.Val

EnumValue implements types.Provider. Schemas declare no enums.

func (*Base) FindIdent

func (b *Base) FindIdent(_ string) (ref.Val, bool)

FindIdent implements types.Provider. Schemas declare no identifiers.

func (*Base) FindStructFieldNames

func (b *Base) FindStructFieldNames(structType string) ([]string, bool)

FindStructFieldNames implements types.Provider.

func (*Base) FindStructFieldType

func (b *Base) FindStructFieldType(structType, fieldName string) (*types.FieldType, bool)

FindStructFieldType implements types.Provider, mapping the field's SQL type to a CEL type via Mapper.

func (*Base) FindStructType

func (b *Base) FindStructType(structType string) (*types.Type, bool)

FindStructType implements types.Provider.

func (*Base) GetSchemas

func (b *Base) GetSchemas() map[string]schema.Schema

GetSchemas returns the schemas known to this provider.

func (*Base) NewValue

func (b *Base) NewValue(_ string, _ map[string]ref.Val) ref.Val

NewValue implements types.Provider. Schema-described types are not constructible.

type TypeMapper

type TypeMapper func(*schema.FieldSchema) *exprpb.Type

TypeMapper converts a dialect field schema to a CEL expression type.

Jump to

Keyboard shortcuts

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