parser

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrParserNotInitialized = fmt.Errorf("parser not initialized")
)

Functions

This section is empty.

Types

type AST added in v0.4.0

type AST map[string]any

func (AST) Alter added in v0.5.0

func (a AST) Alter() (*types.Alter, error)

func (AST) Create added in v0.5.0

func (a AST) Create() (*types.Create, error)

func (AST) Delete added in v0.5.0

func (a AST) Delete() (*types.Delete, error)

func (AST) Drop added in v0.5.0

func (a AST) Drop() (*types.Drop, error)

func (AST) Insert added in v0.5.0

func (a AST) Insert() (*types.Insert, error)

func (AST) Is added in v0.5.0

func (a AST) Is(s types.Statement) bool

func (AST) Select added in v0.5.0

func (a AST) Select() (*types.Select, error)

func (AST) Type added in v0.5.0

func (a AST) Type() types.Statement

func (AST) Update added in v0.5.0

func (a AST) Update() (*types.Update, error)

func (AST) Use added in v0.5.0

func (a AST) Use() (*types.Use, error)

type ASTResult added in v0.3.0

type ASTResult struct {
	*internal.ASTResult
	AST ASTs
}

func NewASTResult added in v0.5.0

func NewASTResult(val *internal.ASTResult) *ASTResult

type ASTs added in v0.4.0

type ASTs []AST

func (ASTs) FindAll added in v0.5.0

func (s ASTs) FindAll(t types.Statement) ASTs

func (ASTs) FindFirst added in v0.5.0

func (s ASTs) FindFirst(t types.Statement) AST

func (ASTs) First added in v0.5.0

func (s ASTs) First() AST

func (ASTs) Len added in v0.5.0

func (s ASTs) Len() int

type Database added in v0.3.0

type Database string
const (
	Athena      Database = "athena"
	BigQuery    Database = "bigquery"
	DB2         Database = "db2"
	FlinkSQL    Database = "flinksql"
	Hive        Database = "hive"
	MariaDB     Database = "mariadb"
	MySQL       Database = "mysql"
	Noql        Database = "noql"
	PostgreSQL  Database = "postgresql"
	Redshift    Database = "redshift"
	Snowflake   Database = "snowflake"
	Sqlite      Database = "sqlite"
	TransactSQL Database = "transactsql"
	Trino       Database = "trino"
)

func (Database) String added in v0.3.0

func (d Database) String() string

type Option added in v0.3.0

type Option interface {
	Opt(types.Option)
}

func WithDatabase added in v0.3.0

func WithDatabase(db Database) Option

type ParseResult added in v0.3.0

type ParseResult struct {
	*ASTResult
	internal.TableColumnList
}

func NewParseResult added in v0.5.0

func NewParseResult(val *internal.ParseResult) *ParseResult

type Parser

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

func New

func New() (*Parser, error)

func (*Parser) Astify

func (p *Parser) Astify(sql string, opts ...Option) (*ASTResult, error)

func (*Parser) ColumnList

func (p *Parser) ColumnList(sql string, opts ...Option) ([]string, error)

func (*Parser) Parse

func (p *Parser) Parse(sql string, opts ...Option) (*ParseResult, error)

func (*Parser) Sqlify

func (p *Parser) Sqlify(ast *ASTResult, opts ...Option) (string, error)

func (*Parser) TableList

func (p *Parser) TableList(sql string, opts ...Option) ([]string, error)

func (*Parser) WhiteListCheck

func (p *Parser) WhiteListCheck(sql string, whiteList []string, opts ...Option) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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