builtinstubs

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package builtinstubs registers metadata-only stubs for CockroachDB builtin functions into the parser's builtins registry. The stubs contain function signatures (parameter types, return type, volatility, function class) but no execution closures, enabling function-name validation, overload resolution, and type-checking of function call arguments without a live database connection.

Stubs are generated from CockroachDB source by cmd/extract-builtins (which dumps a JSON catalog) and cmd/gen-builtins (which emits Go registration code). Multiple CRDB versions can be compiled in; the caller selects one via Init before any SQL is parsed.

Typical usage from cmd/crdb-sql/main.go:

builtinstubs.Init("")  // registers the default version (matches parser)

Index

Constants

View Source
const DefaultVersion = "v26.2"

DefaultVersion is the CRDB version whose stubs are registered when Init is called with an empty string. It should match the cockroachdb-parser module version pinned in go.mod.

Variables

This section is empty.

Functions

func ActiveVersion

func ActiveVersion() string

ActiveVersion returns the version that was registered by Init, or "" if Init has not been called.

func Init

func Init(version string)

Init registers builtin stubs for the given CRDB version. It must be called exactly once, before any SQL parsing occurs. Pass "" to use DefaultVersion. Panics if the version is not compiled in.

func SupportedVersions

func SupportedVersions() []string

SupportedVersions returns all compiled-in stub versions, sorted.

Types

This section is empty.

Jump to

Keyboard shortcuts

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