sqlscanner

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scanner

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

Scanner is the struct used to generate SQL tokens for the parser.

func NewScanner

func NewScanner(sql string) *Scanner

NewScanner creates a new Scanner for sql.

func (*Scanner) Scan

func (s *Scanner) Scan() bool

Scan scans for the next token and returns true if one was found, false if the end of the input stream was reached. When Scan returns true, the token type can be obtained by calling the Token() method, and the text can be obtained by calling the Text() method.

func (*Scanner) Text

func (s *Scanner) Text() string

Text returns the portion of the string that relates to the most recently scanned token.

func (*Scanner) Token

func (s *Scanner) Token() Token

Token returns the most recently scanned token.

type Token

type Token int

Token represents a SQL token.

const (
	OTHER Token = iota // anything we don't specifically care about

	COMMENT

	IDENT  // includes unhandled keywords
	NUMBER // 123, 123.45, 123e+45
	STRING // 'foo'

	PERIOD // .
	COMMA  // ,
	LPAREN // (
	RPAREN // )

	AS
	CALL
	DELETE
	FROM
	INSERT
	INTO
	OR
	REPLACE
	SELECT
	SET
	TABLE
	TRUNCATE // Cassandra/CQL-specific
	UPDATE
)

The list of SQL tokens.

func (Token) String

func (t Token) String() string

Jump to

Keyboard shortcuts

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