Documentation
¶
Overview ¶
Package schema provides dialect-agnostic database schema types for CEL to SQL conversion. These types describe column names, types, array dimensions, and JSON flags without coupling to any specific SQL dialect.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldSchema ¶
type FieldSchema struct {
Name string
Type string // SQL type name (text, integer, boolean, etc.)
Repeated bool // true for arrays
Dimensions int // number of array dimensions (1 for integer[], 2 for integer[][], etc.)
Schema []FieldSchema // for composite types
IsJSON bool // true for json/jsonb types
IsJSONB bool // true for jsonb (vs json)
ElementType string // for arrays: element type name
}
FieldSchema represents a database field type with name, type, and optional nested schema. This type is dialect-agnostic and used by all SQL dialect providers.
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema represents a table schema with O(1) field lookup. It contains a slice of fields for ordered iteration and a map index for fast lookups.
func NewSchema ¶
func NewSchema(fields []FieldSchema) Schema
NewSchema creates a new Schema with field indexing for O(1) lookups. This improves performance for tables with many columns.
func (Schema) Fields ¶
func (s Schema) Fields() []FieldSchema
Fields returns the ordered slice of field schemas. Use this when you need to iterate over fields in their defined order.