diagnostic

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: 2 Imported by: 0

Documentation

Overview

Package diagnostic provides shared types for schema parsing diagnostics.

This package exists to avoid import cycles between the main parser package and dialect-specific parser implementations (e.g., PostgreSQL parser).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diagnostic

type Diagnostic struct {
	Path     string
	Line     int
	Column   int
	Message  string
	Severity Severity
}

Diagnostic captures parser feedback for callers to display.

type IncrementalSchemaParser added in v0.11.0

type IncrementalSchemaParser interface {
	SchemaParser
	// ParseInto parses path/content and applies DDL mutations (CREATE, ALTER,
	// DROP) directly into catalog. Diagnostics are returned and appended to any
	// existing diagnostics in the catalog; the caller owns the slice.
	ParseInto(ctx context.Context, path string, content []byte, catalog *model.Catalog) ([]Diagnostic, error)
}

IncrementalSchemaParser extends SchemaParser with incremental parsing: the caller supplies an existing catalog so that a later file can see tables created by earlier files (enabling cross-file ALTER / DROP resolution). Parsers that do not implement this interface fall back to the original Parse-then-merge behaviour.

type SchemaParser

type SchemaParser interface {
	Parse(ctx context.Context, path string, content []byte) (*model.Catalog, []Diagnostic, error)
}

SchemaParser parses SQL DDL statements and produces a schema catalog.

type Severity

type Severity int

Severity indicates the seriousness of a diagnostic.

const (
	// SeverityError indicates a fatal issue that prevents code generation.
	SeverityError Severity = iota
	// SeverityWarning indicates a potential issue that doesn't prevent code generation.
	SeverityWarning
)

Jump to

Keyboard shortcuts

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