redshift

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Completion

func Completion(ctx context.Context, cCtx base.CompletionContext, statement string, caretLine int, caretOffset int) ([]base.Candidate, error)

Completion is the entry point of Redshift code completion.

func Diagnose

func Diagnose(_ context.Context, _ base.DiagnoseContext, statement string) ([]base.Diagnostic, error)

func GetStatementTypes

func GetStatementTypes(asts []base.AST) ([]string, error)

GetStatementTypes returns the statement types from the given AST.

func NormalizeRedshiftQualifiedName

func NormalizeRedshiftQualifiedName(ctx parser.IQualified_nameContext) []string

func ParseRedshift

func ParseRedshift(sql string) ([]*base.ParseResult, error)

ParseRedshift parses the given SQL statement and returns a list of ParseResults. Each ParseResult represents one statement with its AST, tokens, and base line offset.

func SplitSQL

func SplitSQL(statement string) ([]base.SingleSQL, error)

SplitSQL splits the given SQL statement into multiple SQL statements.

func ValidateSQLForEditor

func ValidateSQLForEditor(statement string) (bool, bool, error)

ValidateSQLForEditor validates the SQL statement for SQL editor. We support the following SQLs: 1. EXPLAIN statement, except EXPLAIN ANALYZE (unless it's EXPLAIN ANALYZE SELECT) 2. SELECT statement We also support CTE with SELECT statements, but not with DML statements. Returns (canRunInReadOnly, returnsData, error): - canRunInReadOnly: whether all queries can run in read-only mode - returnsData: whether all queries return data - error: parsing error if the statement is invalid

Types

type CTETableListener

type CTETableListener struct {
	*parser.BaseRedshiftParserListener
	// contains filtered or unexported fields
}

func (*CTETableListener) EnterCommon_table_expr

func (l *CTETableListener) EnterCommon_table_expr(ctx *parser.Common_table_exprContext)

type Completer

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

func NewStandardCompleter

func NewStandardCompleter(ctx context.Context, cCtx base.CompletionContext, statement string, caretLine int, caretOffset int) *Completer

func NewTrickyCompleter

func NewTrickyCompleter(ctx context.Context, cCtx base.CompletionContext, statement string, caretLine int, caretOffset int) *Completer

type CompletionMap

type CompletionMap map[string]base.Candidate

func (CompletionMap) Insert

func (m CompletionMap) Insert(entry base.Candidate)

type ObjectFlags

type ObjectFlags int
const (
	ObjectFlagsShowSchemas ObjectFlags = 1 << iota
	ObjectFlagsShowTables
	ObjectFlagsShowColumns
	ObjectFlagsShowFirst
	ObjectFlagsShowSecond
)

type TableRefListener

type TableRefListener struct {
	*parser.BaseRedshiftParserListener
	// contains filtered or unexported fields
}

func (*TableRefListener) EnterSelect_with_parens

func (l *TableRefListener) EnterSelect_with_parens(_ *parser.Select_with_parensContext)

func (*TableRefListener) EnterTable_ref

func (l *TableRefListener) EnterTable_ref(ctx *parser.Table_refContext)

func (*TableRefListener) ExitSelect_with_parens

func (l *TableRefListener) ExitSelect_with_parens(_ *parser.Select_with_parensContext)

func (*TableRefListener) ExitTable_ref

func (l *TableRefListener) ExitTable_ref(ctx *parser.Table_refContext)

type TargetAliasListener

type TargetAliasListener struct {
	*parser.BaseRedshiftParserListener
	// contains filtered or unexported fields
}

func (*TargetAliasListener) EnterTarget_alias

func (l *TargetAliasListener) EnterTarget_alias(ctx *parser.Target_aliasContext)

Jump to

Keyboard shortcuts

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