Documentation ¶
Index ¶
- type ANDNode
- type BinOpNode
- type BoolConstNode
- type CaseNode
- type ColRefNode
- type ColWildcardNode
- type CreateTableNode
- type CrossJoinNode
- type DeleteNode
- type DropTableNode
- type EmptyTable
- func (t *EmptyTable) Copy() backend.Table
- func (t *EmptyTable) CrossJoin(backend.Table) (backend.Table, error)
- func (t *EmptyTable) Delete(func(backend.Row) (core.Value, error)) (backend.Table, error)
- func (t *EmptyTable) GetColNames() core.ColumnNames
- func (t *EmptyTable) GetCols() core.Cols
- func (t *EmptyTable) GetName() string
- func (t *EmptyTable) GetRows() []backend.Row
- func (t *EmptyTable) InsertValues(cs core.ColumnNames, vs core.ValuesList) error
- func (t *EmptyTable) Limit(n int) (backend.Table, error)
- func (t *EmptyTable) OrderBy(ns core.ColumnNames, dirs []int) (backend.Table, error)
- func (t *EmptyTable) Project(cs core.ColumnNames, fns []func(backend.Row) (core.Value, error)) (backend.Table, error)
- func (t *EmptyTable) RenameTableName(name string)
- func (t *EmptyTable) Update(colNames core.ColumnNames, condFn func(backend.Row) (core.Value, error), ...) (backend.Table, error)
- func (t *EmptyTable) Where(fn func(backend.Row) (core.Value, error)) (backend.Table, error)
- type EmptyTableRow
- type ExpressionNode
- type FloatNode
- type InsertNode
- type IntegerNode
- type LimitNode
- type MathOp
- type NotNode
- type NullTestNode
- type NullTestType
- type ORNode
- type OrderByNode
- type PGTranlator
- func (pg *PGTranlator) Translate() (Statement, error)
- func (pg *PGTranlator) TranslateCreateTable(stmt *pg_query.CreateStmt) (RelationalAlgebraNode, error)
- func (pg *PGTranlator) TranslateDelete(node *pg_query.DeleteStmt) (RelationalAlgebraNode, error)
- func (pg *PGTranlator) TranslateDropTable(node *pg_query.DropStmt) (RelationalAlgebraNode, error)
- func (pg *PGTranlator) TranslateInsert(stmt *pg_query.InsertStmt) (RelationalAlgebraNode, error)
- func (pg *PGTranlator) TranslateSelect(pgtree *pg_query.SelectStmt) (RelationalAlgebraNode, error)
- func (pg *PGTranlator) TranslateUpdate(node *pg_query.UpdateStmt) (RelationalAlgebraNode, error)
- type ProjectionNode
- type QueryResult
- type QueryStatement
- type RelationalAlgebraNode
- type RenameTableNode
- type Result
- type Statement
- type StringNode
- type TableNode
- type Translator
- type UpdateNode
- type WhereNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ANDNode ¶
type ANDNode struct { Lexpr ExpressionNode Rexpr ExpressionNode }
ANDNode is expression of AND
type BinOpNode ¶
type BinOpNode struct { Op MathOp Lexpr ExpressionNode Rexpr ExpressionNode }
BinOpNode is expression of BinOpNode
type BoolConstNode ¶
BoolConstNode is expression of boolean const
type CaseNode ¶
type CaseNode struct { CaseWhenExprs []ExpressionNode CaseResultExprs []ExpressionNode DefaultResult ExpressionNode }
CaseNode is expression of CaseNode
type ColRefNode ¶
type ColRefNode struct {
ColName core.ColumnName
}
ColRefNode is expression of integer
type CreateTableNode ¶
CreateTableNode is a node of create statement
type CrossJoinNode ¶
type CrossJoinNode struct {
RANodes []RelationalAlgebraNode
}
CrossJoinNode is a node of cross join.
type DeleteNode ¶
type DeleteNode struct { Condition ExpressionNode TableName string }
DeleteNode is a node of update statement
type DropTableNode ¶
type DropTableNode struct {
TableNames []string
}
DropTableNode is a node of drop statement
type EmptyTable ¶
type EmptyTable struct { ColNames core.ColumnNames Rows []*EmptyTableRow }
func (*EmptyTable) Copy ¶
func (t *EmptyTable) Copy() backend.Table
func (*EmptyTable) GetColNames ¶
func (t *EmptyTable) GetColNames() core.ColumnNames
func (*EmptyTable) GetCols ¶
func (t *EmptyTable) GetCols() core.Cols
func (*EmptyTable) GetName ¶
func (t *EmptyTable) GetName() string
func (*EmptyTable) GetRows ¶
func (t *EmptyTable) GetRows() []backend.Row
func (*EmptyTable) InsertValues ¶
func (t *EmptyTable) InsertValues(cs core.ColumnNames, vs core.ValuesList) error
func (*EmptyTable) OrderBy ¶
func (t *EmptyTable) OrderBy(ns core.ColumnNames, dirs []int) (backend.Table, error)
func (*EmptyTable) RenameTableName ¶
func (t *EmptyTable) RenameTableName(name string)
type EmptyTableRow ¶
type EmptyTableRow struct { ColNames core.ColumnNames Values core.Values }
func (*EmptyTableRow) GetColNames ¶
func (r *EmptyTableRow) GetColNames() core.ColumnNames
func (*EmptyTableRow) GetValueByColName ¶
func (r *EmptyTableRow) GetValueByColName(core.ColumnName) (core.Value, error)
func (*EmptyTableRow) GetValues ¶
func (r *EmptyTableRow) GetValues() core.Values
func (*EmptyTableRow) UpdateValue ¶
func (r *EmptyTableRow) UpdateValue(name core.ColumnName, val core.Value)
type ExpressionNode ¶
ExpressionNode is interface of boolean expression
type InsertNode ¶
type InsertNode struct { TableName string ColumnNames core.ColumnNames ValuesList core.ValuesList }
InsertNode is a node of create statement
type LimitNode ¶
type LimitNode struct { Count int RANode RelationalAlgebraNode }
LimitNode is a Node for limit clause
type NullTestNode ¶
type NullTestNode struct { TestType NullTestType Expr ExpressionNode }
NullTestNode is expression of `IS (NOT) NULL`
type NullTestType ¶
type NullTestType int
NullTestType is Null test type
const ( // EqualNull corresponds to `IS NULL` operation EqualNull NullTestType = iota // NotEqualNull corresponds to `IS NOT NULL` operation NotEqualNull )
type ORNode ¶
type ORNode struct { Lexpr ExpressionNode Rexpr ExpressionNode }
ORNode is expression of OR
type OrderByNode ¶
type OrderByNode struct { SortKeys core.ColumnNames SortDirs []int RANode RelationalAlgebraNode }
OrderByNode is a Node for order by clause
type PGTranlator ¶
type PGTranlator struct {
// contains filtered or unexported fields
}
PGTranlator is translator for PostgreSQL syntax
func NewPGTranslator ¶
func NewPGTranslator(query string) *PGTranlator
NewPGTranslator is a constructor of PGTranlator
func (*PGTranlator) Translate ¶
func (pg *PGTranlator) Translate() (Statement, error)
Translate translates a postgres parse tree into RelationalAlgebraNode
func (*PGTranlator) TranslateCreateTable ¶
func (pg *PGTranlator) TranslateCreateTable(stmt *pg_query.CreateStmt) (RelationalAlgebraNode, error)
TranslateCreateTable translates sql parse tree into CreateTableNode
func (*PGTranlator) TranslateDelete ¶
func (pg *PGTranlator) TranslateDelete(node *pg_query.DeleteStmt) (RelationalAlgebraNode, error)
TranslateDelete translates sql parse tree into DeleteNode
func (*PGTranlator) TranslateDropTable ¶
func (pg *PGTranlator) TranslateDropTable(node *pg_query.DropStmt) (RelationalAlgebraNode, error)
TranslateDropTable translates sql parse tree into DropTableNode
func (*PGTranlator) TranslateInsert ¶
func (pg *PGTranlator) TranslateInsert(stmt *pg_query.InsertStmt) (RelationalAlgebraNode, error)
TranslateInsert translates sql parse tree into InsertNode
func (*PGTranlator) TranslateSelect ¶
func (pg *PGTranlator) TranslateSelect(pgtree *pg_query.SelectStmt) (RelationalAlgebraNode, error)
TranslateSelect translates postgres a select statement into ProjectionNode
func (*PGTranlator) TranslateUpdate ¶
func (pg *PGTranlator) TranslateUpdate(node *pg_query.UpdateStmt) (RelationalAlgebraNode, error)
TranslateUpdate translates sql parse tree into UpdateNode
type ProjectionNode ¶
type ProjectionNode struct { ResTargets []ExpressionNode TargetColNames core.ColumnNames RANode RelationalAlgebraNode }
ProjectionNode is Node of projection operation
type QueryResult ¶
type QueryResult struct { Columns []string Records core.ValuesList }
QueryResult is result of query
func (*QueryResult) GetColumns ¶
func (qr *QueryResult) GetColumns() []string
GetColumns gets column name of records
func (*QueryResult) GetRecords ¶
func (qr *QueryResult) GetRecords() core.ValuesList
GetRecords gets records from query result
type QueryStatement ¶
type QueryStatement struct {
RANode RelationalAlgebraNode
}
QueryStatement is statement of query
type RelationalAlgebraNode ¶
RelationalAlgebraNode is interface of RelationalAlgebraNode
type RenameTableNode ¶
type RenameTableNode struct { Alias string Table RelationalAlgebraNode }
RenameTableNode is Node for renaming tabel
type Result ¶
type Result interface { GetRecords() core.ValuesList GetColumns() []string }
Result is interface of query result
type Translator ¶
type Translator interface {
Translate() RelationalAlgebraNode
}
Translator is an interface for translator of SQL parse
type UpdateNode ¶
type UpdateNode struct { Condition ExpressionNode ColNames core.ColumnNames AssignExpr []ExpressionNode TableName string }
UpdateNode is a node of update statement