parser

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoveCommentInSQLStatement

func RemoveCommentInSQLStatement(sql string) (string, error)

RemoveCommentInSQLStatement removes the comments in the SQL statement, including single line comment (--) and multiple line comment (/*...*/)

Types

type SQLFlowStmt

type SQLFlowStmt struct {
	IsUnfinishedSelect bool
	Original           string
	*SQLFlowSelectStmt
	Inputs  []string
	Outputs []string
}

SQLFlowStmt represents a parsed SQL statement. The original statement is in Original. If it is a standard SQL statement, Original has the statement as well, and Extended is nil. Or, if it is a statement with SQLFlow syntax extension, Original is the whole statement and Extended is the parsed extension.

func Parse

func Parse(dialect, program string) ([]*SQLFlowStmt, error)

Parse a SQL program in the given dialect into a list of SQL statements.

func ParseStatement

func ParseStatement(dialect, program string) (*SQLFlowStmt, error)

ParseStatement parses a SQL program by calling Parse, and asserts that this program contains one and only one statement. Notice: If program contains more than one statement, we should call sql.RewriteSQLWithHints

func (*SQLFlowStmt) IsExtendedSyntax

func (stmt *SQLFlowStmt) IsExtendedSyntax() bool

IsExtendedSyntax returns true if a parsed statement uses any SQLFlow syntax extensions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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