errors

package
v0.39.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: 3 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

View Source
const (
	ErrorMessageContextDefault = 100
)

Variables

This section is empty.

Functions

func ConcatMessages

func ConcatMessages(errs []error, maximum int) string

ConcatMessages joins up to maximum errors with blank lines and appends an "... and N more" summary. A negative maximum is treated as zero: the value is a count, and a negative bound previously made the slice expression invalid.

func HighlightSQL

func HighlightSQL(sql string, positions [][2]int, ctxLen int) (formatted, startContext, highlight, endContext string)

HighlightSQL underlines the given byte positions in sql and returns the surrounding context. It panics when positions is empty: every caller derives the positions from a parsed error, so an empty list is a programming error rather than bad user input.

func MergeErrors

func MergeErrors(errs []*ParseError) []map[string]any

Types

type ErrorLevel

type ErrorLevel int
const (
	IGNORE ErrorLevel = iota
	WARN
	RAISE
	IMMEDIATE
)

func (ErrorLevel) String

func (e ErrorLevel) String() string

type ExecuteError

type ExecuteError struct{ Msg string }

func (*ExecuteError) Error

func (e *ExecuteError) Error() string

type OptimizeError

type OptimizeError struct{ Msg string }

func (*OptimizeError) Error

func (e *OptimizeError) Error() string

type ParseError

type ParseError struct {
	Msg    string
	Errors []map[string]any
}

func NewParseError

func NewParseError(message string, fields ...map[string]any) *ParseError

func NewParseErrorWithLocation

func NewParseErrorWithLocation(message, description string, line, col int, startContext, highlight, endContext string) *ParseError

func (*ParseError) Error

func (e *ParseError) Error() string

type Position

type Position struct {
	Start int
	End   int
}

type SchemaError

type SchemaError struct{ Msg string }

func NewSchemaError

func NewSchemaError(format string, args ...any) *SchemaError

func (*SchemaError) Error

func (e *SchemaError) Error() string

type SqlglotError

type SqlglotError struct{ Msg string }

func (*SqlglotError) Error

func (e *SqlglotError) Error() string

type TokenError

type TokenError struct{ Msg string }

func (*TokenError) Error

func (e *TokenError) Error() string

type UnsupportedError

type UnsupportedError struct{ Msg string }

func (*UnsupportedError) Error

func (e *UnsupportedError) Error() string

Jump to

Keyboard shortcuts

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