duckdbsql

package
v0.47.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeStringValue added in v0.47.0

func EscapeStringValue(s string) string

EscapeStringValue escapes a string value for use in an expression passed to EvaluateBool.

func EvaluateBool added in v0.33.0

func EvaluateBool(expr string) (bool, error)

EvaluateBool uses DuckDB to evaluate the given expression as a boolean value.

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 PositionError added in v0.43.0

type PositionError struct {
	Position int
	// contains filtered or unexported fields
}

func (PositionError) Err added in v0.43.0

func (e PositionError) Err() error

type TableRef

type TableRef struct {
	Name       string
	Function   string
	Paths      []string
	Properties map[string]any
	LocalAlias bool
	// Params passed to sqlite_scan
	Params []string
}

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