Documentation
¶
Index ¶
- Constants
- func ConcatMessages(errs []error, maximum int) string
- func HighlightSQL(sql string, positions [][2]int, ctxLen int) (formatted, startContext, highlight, endContext string)
- func MergeErrors(errs []*ParseError) []map[string]any
- type ErrorLevel
- type ExecuteError
- type OptimizeError
- type ParseError
- type Position
- type SchemaError
- type SqlglotError
- type TokenError
- type UnsupportedError
Constants ¶
const (
ErrorMessageContextDefault = 100
)
Variables ¶
This section is empty.
Functions ¶
func ConcatMessages ¶
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 ¶
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 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