Documentation
¶
Index ¶
- func QueriesInTopologicalOrder(queries []string, execQueryFunc ExecQueryFunc) ([]string, error)
- func RunQueriesInTopologicalOrder(queries []string, execQueryFunc ExecQueryFunc) error
- type Ast
- func (a *Ast) AddColumnDeclarations() []string
- func (a *Ast) AlterQueryStatements() []string
- func (a *Ast) CommentColumnIdentifiers() []string
- func (a *Ast) CreateFunctionStatements() []string
- func (a *Ast) CreateTableAndViewStatements() []string
- func (a *Ast) CreateTableColumnDeclarations() []string
- func (a *Ast) DropOrClearColumnIdentifiers() []string
- func (a *Ast) DropTableOrViewStatements() []string
- func (a *Ast) FunctionCalls() []string
- func (a *Ast) MaterializeColumnIdentifiers() []string
- func (a *Ast) ModifyColumnDeclarations() []string
- func (a *Ast) NodesForMatch(matcher func(node *AstNode) bool) []*AstNode
- func (a *Ast) RenameColumnFromIdentifiers() []string
- func (a *Ast) RenameColumnToIdentifiers() []string
- func (a *Ast) RenameIdentifiers() []string
- func (a *Ast) SelectColumnIdentifiers() []string
- func (a *Ast) SelectColumnNodes() []*AstNode
- func (a *Ast) SelectColumnTableQualifiers() []string
- func (a *Ast) TableAndViewIdentifiers() []string
- func (a *Ast) ValuesForMatch(matcher func(node *AstNode) bool) []string
- type AstNode
- type ExecQueryFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QueriesInTopologicalOrder ¶
func QueriesInTopologicalOrder(queries []string, execQueryFunc ExecQueryFunc) ([]string, error)
func RunQueriesInTopologicalOrder ¶
func RunQueriesInTopologicalOrder(queries []string, execQueryFunc ExecQueryFunc) error
Types ¶
type Ast ¶
func NewFromQuery ¶
func NewFromQuery(query string, execQueryFunc ExecQueryFunc) (*Ast, error)
func PopulateAndSort ¶
func (*Ast) AddColumnDeclarations ¶
func (*Ast) AlterQueryStatements ¶
func (*Ast) CommentColumnIdentifiers ¶
func (*Ast) CreateFunctionStatements ¶
func (*Ast) CreateTableAndViewStatements ¶
func (*Ast) CreateTableColumnDeclarations ¶
TODO: document node types of interest
func (*Ast) DropOrClearColumnIdentifiers ¶
alter table clear column also uses drop column as the command type
func (*Ast) DropTableOrViewStatements ¶
func (*Ast) FunctionCalls ¶
func (*Ast) MaterializeColumnIdentifiers ¶
func (*Ast) ModifyColumnDeclarations ¶
func (*Ast) NodesForMatch ¶
func (*Ast) RenameColumnFromIdentifiers ¶
func (*Ast) RenameColumnToIdentifiers ¶
func (*Ast) RenameIdentifiers ¶
must come after any create and before any drop
func (*Ast) SelectColumnIdentifiers ¶
func (*Ast) SelectColumnNodes ¶
TODO: use this for matching against aliases. Special case single table select and always set valueIdentifier to table being selected from
func (*Ast) SelectColumnTableQualifiers ¶
func (*Ast) TableAndViewIdentifiers ¶
type AstNode ¶
type AstNode struct { RawLine string Indent int Type string Value string // Think table name, database name, etc. ValueQualifier string Alias string Meta string // Hash int64 // hash of the node and // children to quickly compare branches Parent *AstNode Children []*AstNode }
TODO: add hash
type ExecQueryFunc ¶
TODO: return err instead of panicking
Click to show internal directories.
Click to hide internal directories.