duckdbsql

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AST added in v0.29.1

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

func Parse added in v0.29.1

func Parse(sql string) (*AST, error)

func (*AST) ExtractColumnRefs added in v0.29.1

func (a *AST) ExtractColumnRefs() []*ColumnRef

ExtractColumnRefs extracts column references from the outermost SELECT of a DuckDB SQL statement

func (*AST) Format added in v0.29.1

func (a *AST) Format() (string, error)

Format normalizes a DuckDB SQL statement

func (*AST) GetTableRefs added in v0.31.0

func (a *AST) GetTableRefs() []*TableRef

func (*AST) RewriteLimit added in v0.29.1

func (a *AST) RewriteLimit(limit, offset int) error

RewriteLimit rewrites a DuckDB SQL statement to limit the result size

func (*AST) RewriteTableRefs added in v0.29.1

func (a *AST) RewriteTableRefs(fn func(table *TableRef) (*TableRef, bool)) error

RewriteTableRefs replaces table references in a DuckDB SQL query. Only replacing with a base table reference is supported right now.

type ColumnRef

type ColumnRef struct {
	Name         string
	RelationName string
	Expr         string
	IsAggr       bool
	IsStar       bool
	IsExclude    bool
}

ColumnRef has information about a column in the select list of a DuckDB SQL statement

type TableRef

type TableRef struct {
	Name       string
	Function   string
	Paths      []string
	Properties map[string]any
	LocalAlias bool
}

TableRef has information extracted about a DuckDB table or table function reference

Jump to

Keyboard shortcuts

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