bqparser

package
v0.8.9 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromClauseHasJoinWithoutOn

func FromClauseHasJoinWithoutOn(fromClause *Node, src string) bool

FromClauseHasJoinWithoutOn reports whether fromClause contains a JOIN keyword not matched by an ON condition, by scanning tokens at depth 0.

func LastPipeOperatorEnd added in v0.8.1

func LastPipeOperatorEnd(src string) (uint, bool)

LastPipeOperatorEnd returns the end offset of the last pipe operator "|>" in src that belongs to the query open at the end of src, that is, the pipe operator is in the same statement and at the same parenthesis depth.

func SelectListItemOnNextLine added in v0.8.8

func SelectListItemOnNextLine(src string, offset uint) (wordStart, wordEnd uint, ok bool)

SelectListItemOnNextLine reports the word before the select list item that the token at offset belongs to, when the item starts a line and that word ends the line before. Such a word is likely being typed in front of an existing item, still without its comma.

func SkipComment added in v0.8.9

func SkipComment(sql string, start int) int

SkipComment returns the offset after the comment starting at sql[start], or start when no comment starts there. An unterminated block comment runs to the end of sql.

func SkipQuoted added in v0.8.9

func SkipQuoted(sql string, start int) (end int, closed bool)

SkipQuoted returns the offset after the string literal or backtick identifier starting at sql[start], and whether it is terminated. An unterminated one runs to the end of sql.

Only ' and " open triple-quoted strings, since GoogleSQL has no triple-backtick identifiers. Backslashes always skip the next byte: in GoogleSQL even raw strings cannot be terminated by an escaped quote, so raw/bytes prefixes need no special case.

Types

type Node

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

Node represents an AST node for BigQuery SQL.

func Parse

func Parse(sql string) *Node

Parse parses a BigQuery SQL string and returns the root "program" node.

func (*Node) ChildCount

func (n *Node) ChildCount() uint

func (*Node) EndByte

func (n *Node) EndByte() uint

func (*Node) FieldNameForChild

func (n *Node) FieldNameForChild(_ uint32) string

func (*Node) Kind

func (n *Node) Kind() string

func (*Node) NamedChild

func (n *Node) NamedChild(i uint) *Node

func (*Node) NamedChildCount

func (n *Node) NamedChildCount() uint

func (*Node) StartByte

func (n *Node) StartByte() uint

Jump to

Keyboard shortcuts

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