Skip to content

Commit

Permalink
Merge pull request #2716 from dolthub/fulghum/ping
Browse files Browse the repository at this point in the history
Update Parser interface documentation
  • Loading branch information
fulghum authored Oct 24, 2024
2 parents 9322ec4 + b2a7b43 commit 824fa1d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions sql/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,21 @@ import (
var GlobalParser Parser = NewMysqlParser()

type Parser interface {
// ParseSimple takes only query string and returns the parsed statement.
// ParseSimple takes a |query| and returns the parsed statement. If |query| represents a no-op statement,
// such as ";" or "-- comment", then implementations must return Vitess' ErrEmpty error.
ParseSimple(query string) (ast.Statement, error)
// Parse parses using default parser options of the ctx and returns the parsed statement
// along with the query string and remainder string if it's multiple queries.
// Parse parses |query| using the default parser options of the ctx and returns the parsed statement
// along with the query string and remainder string if it's multiple queries. If |query| represents a
// no-op statement, such as ";" or "-- comment", then implementations must return Vitess' ErrEmpty error.
Parse(ctx *Context, query string, multi bool) (ast.Statement, string, string, error)
// ParseWithOptions parses using given parser options and returns the parsed statement
// along with the query string and remainder string if it's multiple queries.
// ParseWithOptions parses |query| using the given parser |options| and specified |delimiter|. The parsed statement
// is returned, along with the query string and remainder string if |multi| has been set to true and there are
// multiple statements in |query|. If |query| represents a no-op statement, such as ";" or "-- comment", then
// implementations must return Vitess' ErrEmpty error.
ParseWithOptions(ctx context.Context, query string, delimiter rune, multi bool, options ast.ParserOptions) (ast.Statement, string, string, error)
// ParseOneWithOptions parses the first query using specified parsing returns the parsed statement along with
// the index of the start of the next query.
// the index of the start of the next query. If |query| represents a no-op statement, such as ";" or "-- comment",
// then implementations must return Vitess' ErrEmpty error.
ParseOneWithOptions(context.Context, string, ast.ParserOptions) (ast.Statement, int, error)
}

Expand Down

0 comments on commit 824fa1d

Please sign in to comment.