internal

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type AST

type AST map[string]any

func (AST) Alter

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

func (AST) Create

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

func (AST) Delete

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

func (AST) Drop

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

func (AST) Insert

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

func (AST) Is

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

func (AST) Select

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

func (AST) Type

func (a AST) Type() types.Statement

func (AST) Update

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

func (AST) Use

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

type ASTResult

type ASTResult struct {
	ASTs
	First AST
	// contains filtered or unexported fields
}

func NewASTResult

func NewASTResult(vm *goja.Runtime, val goja.Value) (*ASTResult, error)

type ASTs

type ASTs []AST

func (ASTs) FindAll

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

func (ASTs) FindFirst

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

type Database

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

func (d Database) String() string

type ParseResult

type ParseResult struct {
	*ASTResult
	TableColumnList
}

func NewParseResult

func NewParseResult(vm *goja.Runtime, val goja.Value) (*ParseResult, error)

type Parser

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

func NewParser

func NewParser() (*Parser, error)

func (*Parser) Astify

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

astify(sql: string, opt?: Option): AST[] | AST;

func (*Parser) ColumnList

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

columnList(sql: string, opt?: Option): string[];

func (*Parser) Parse

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

parse(sql: string, opt?: Option): TableColumnAst;

func (*Parser) Sqlify

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

sqlify(ast: AST[] | AST, opt?: Option): string;

func (*Parser) TableList

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

tableList(sql: string, opt?: Option): string[];

func (*Parser) WhiteListCheck

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

whiteListCheck(sql: string, whiteList: string[], opt?: Option): Error | undefined;

type TableColumnList

type TableColumnList struct {
	TableList  []string `json:"tableList"`
	ColumnList []string `json:"columnList"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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