parser

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package parser implements a DDL parser for SQLite schemas.

Index

Constants

View Source
const (
	SeverityError   = diagnostic.SeverityError
	SeverityWarning = diagnostic.SeverityWarning
)

Severity constants for backward compatibility.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diagnostic

type Diagnostic = diagnostic.Diagnostic

Diagnostic is an alias for backward compatibility.

func Parse

func Parse(path string, tokens []tokenizer.Token) (*model.Catalog, []Diagnostic, error)

Parse constructs a catalog from the provided tokens, collecting diagnostics.

func ParseWithCatalog added in v0.11.0

func ParseWithCatalog(path string, tokens []tokenizer.Token, catalog *model.Catalog) (*model.Catalog, []Diagnostic, error)

ParseWithCatalog constructs a catalog by parsing tokens and applying DDL mutations into catalog. It is the incremental variant of Parse: by seeding catalog with tables from previously-parsed files, ALTER/DROP statements in the current file can resolve tables from earlier files. The caller owns catalog; after the call it is mutated in place and also returned.

type IncrementalSchemaParser added in v0.11.0

type IncrementalSchemaParser = diagnostic.IncrementalSchemaParser

IncrementalSchemaParser is an alias exposing the incremental-parse interface.

type Parser

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

Parser consumes tokenizer output and produces a normalized catalog.

type SchemaParser

type SchemaParser = diagnostic.SchemaParser

SchemaParser is an alias for backward compatibility.

func NewSchemaParser

func NewSchemaParser(dialect string) (SchemaParser, error)

NewSchemaParser creates a new SchemaParser for the specified dialect. "sqlite" and "turso" are supported (Turso parses SQLite-compatible DDL). For PostgreSQL, use the postgres package directly.

type Severity

type Severity = diagnostic.Severity

Severity is an alias for backward compatibility.

Directories

Path Synopsis
Package clickhouse provides a ClickHouse DDL parser.
Package clickhouse provides a ClickHouse DDL parser.
Package mysql provides SQL keyword constants for the MySQL parser.
Package mysql provides SQL keyword constants for the MySQL parser.
Package postgres provides SQL keyword constants for the PostgreSQL parser.
Package postgres provides SQL keyword constants for the PostgreSQL parser.

Jump to

Keyboard shortcuts

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