Documentation
¶
Overview ¶
Package sqlglot exposes a sqlglot-like API for Go. It wraps internal/ANTLR-based parsing to produce stable "signatures" (normalized SQL digests) and parameter extraction, inspired by python sqlglot.
Typical usage:
dig, params, err := sqlglot.Signature(sql, sqlglot.Options{Dialect: sqlglot.Postgres})
Index ¶
- Constants
- Variables
- func ExtractFamily(sql string, opt Options) (string, error)
- func Parse(sql string, opt Options) (any, error)
- func ParseOne(sql string, opt Options) (any, error)
- func Transpile(sql string, from Dialect, to Dialect, opt Options) (string, error)
- type Dialect
- type ExParam
- type Options
- type Result
Constants ¶
Variables ¶
View Source
var ErrNotImplemented = errors.New("not implemented")
Functions ¶
func ExtractFamily ¶ added in v1.0.4
ExtractFamily:单独获取 Family key 的便捷函数。
Types ¶
type ExParam ¶
Also surface core Options/Result/ExParam for convenience.
func ExtractParams ¶
ExtractParams returns only the parameters discovered in SQL.
func Signature ¶
func Signature(sql string, opt Options) (digest string, params []ExParam, types []string, err error)
Signature normalizes SQL into a stable digest and extracts parameters. This mirrors sqlglot's top-level convenience APIs (parse/transpile/normalize), but focuses on digest/params which your engine specializes in.
Click to show internal directories.
Click to hide internal directories.