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 ¶
- type Base
- func (b *Base) Close()
- func (b *Base) EnumValue(_ string) ref.Val
- func (b *Base) FindIdent(_ string) (ref.Val, bool)
- func (b *Base) FindStructFieldNames(structType string) ([]string, bool)
- func (b *Base) FindStructFieldType(structType, fieldName string) (*types.FieldType, bool)
- func (b *Base) FindStructType(structType string) (*types.Type, bool)
- func (b *Base) GetSchemas() map[string]schema.Schema
- func (b *Base) NewValue(_ string, _ map[string]ref.Val) ref.Val
- type TypeMapper
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) FindStructFieldNames ¶
FindStructFieldNames implements types.Provider.
func (*Base) FindStructFieldType ¶
FindStructFieldType implements types.Provider, mapping the field's SQL type to a CEL type via Mapper.
func (*Base) FindStructType ¶
FindStructType implements types.Provider.
func (*Base) GetSchemas ¶
GetSchemas returns the schemas known to this provider.
type TypeMapper ¶
type TypeMapper func(*schema.FieldSchema) *exprpb.Type
TypeMapper converts a dialect field schema to a CEL expression type.