schema

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mapping

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

func M

func M(pairs ...any) *Mapping

func NewMapping

func NewMapping() *Mapping

func (*Mapping) Copy

func (m *Mapping) Copy() *Mapping

func (*Mapping) Get

func (m *Mapping) Get(k string) (any, bool)

func (*Mapping) Keys

func (m *Mapping) Keys() []string

func (*Mapping) Len

func (m *Mapping) Len() int

func (*Mapping) Set

func (m *Mapping) Set(k string, v any)

type MappingSchema

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

func NewMappingSchema

func NewMappingSchema(schema *Mapping, dialect dialects.DialectType, normalize bool) (*MappingSchema, error)

func NewMappingSchemaWithImplicit

func NewMappingSchemaWithImplicit(schema *Mapping, implicit *Mapping, dialect dialects.DialectType, normalize bool) (*MappingSchema, error)

NewMappingSchemaWithImplicit is NewMappingSchema plus a NON-UPSTREAM implicit-column marking (DEVIATIONS): implicit mirrors the mapping's nesting with []string leaves naming the columns that exist in the mapping but are engine-implicit (e.g. PG's ctid/xmin/xmax/cmin/cmax/tableoid). An implicit column resolves like any column when named explicitly, but is excluded from `SELECT *` / `t.*` expansion and from NATURAL JOIN / USING candidate sets — the upstream `visible` mechanism, populated as the implicit set's complement. The implicit *Mapping uses the same node keys as the RAW mapping (pre-normalization, never re-split on dots — a table literally named "x.foo" is a node key like any other): depth 1 = table → []string, depth 2 = schema → table → []string, depth 3 = catalog → schema → table → []string (the primary consumer shape). An implicit key or column absent from the mapping is an input error (fail-closed), never silently ignored.

func (*MappingSchema) AddTable

func (m *MappingSchema) AddTable(table any, columnMapping any, dialect dialects.DialectType, normalize *bool, matchDepth bool) error

func (*MappingSchema) ColumnNames

func (m *MappingSchema) ColumnNames(table any, onlyVisible bool, dialect dialects.DialectType, normalize *bool) ([]string, error)

func (*MappingSchema) Dialect

func (m *MappingSchema) Dialect() *dialects.Dialect

func (*MappingSchema) Empty

func (m *MappingSchema) Empty() bool

func (*MappingSchema) Find

func (m *MappingSchema) Find(table exp.Expression, raiseOnMissing bool, ensureDataTypes bool) (*Mapping, error)

func (*MappingSchema) GetColumnType

func (m *MappingSchema) GetColumnType(table any, column any, dialect dialects.DialectType, normalize *bool) (exp.Expression, error)

func (*MappingSchema) GetUDFType

func (m *MappingSchema) GetUDFType(udf any, dialect dialects.DialectType, normalize *bool) (exp.Expression, error)

func (*MappingSchema) HasColumn

func (m *MappingSchema) HasColumn(table any, column any, dialect dialects.DialectType, normalize *bool) (bool, error)

func (*MappingSchema) SupportedTableArgs

func (m *MappingSchema) SupportedTableArgs() []string

type Schema

type Schema interface {
	AddTable(table any, columnMapping any, dialect dialects.DialectType, normalize *bool, matchDepth bool) error
	ColumnNames(table any, onlyVisible bool, dialect dialects.DialectType, normalize *bool) ([]string, error)
	GetColumnType(table any, column any, dialect dialects.DialectType, normalize *bool) (exp.Expression, error)
	HasColumn(table any, column any, dialect dialects.DialectType, normalize *bool) (bool, error)
	GetUDFType(udf any, dialect dialects.DialectType, normalize *bool) (exp.Expression, error)
	SupportedTableArgs() []string
	Empty() bool
	Dialect() *dialects.Dialect
	Find(table exp.Expression, raiseOnMissing bool, ensureDataTypes bool) (*Mapping, error)
}

func EnsureSchema

func EnsureSchema(s SchemaType, dialect dialects.DialectType, normalize bool) (Schema, error)

type SchemaType

type SchemaType = any

SchemaType is the polymorphic column-schema argument, mirroring upstream sqlglot's SchemaType. A value is one of:

  • nil — an empty schema
  • *Mapping — a column-name→type mapping (build one with schema.M or NewMapping)
  • Schema — an already-built Schema (e.g. *MappingSchema), returned as-is

It is a type alias for any, so it is fully interchangeable with any: adding it to a signature never breaks an existing caller.

type TrieResult

type TrieResult int
const (
	TrieFailed TrieResult = iota
	TriePrefix
	TrieExists
)

Jump to

Keyboard shortcuts

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