Documentation
¶
Index ¶
- Variables
- type AliasedRelation
- type AllColumns
- type AstVisitor
- type Expression
- type GroupBy
- type GroupingElement
- type IExpression
- type IGroupingElement
- type IJoinCriteria
- type INode
- type IQueryBody
- type IRelation
- type ISelectItem
- type IStatement
- type Identifier
- type Join
- type JoinOn
- type JoinType
- type JoinUsing
- type LogicalBinaryExpType
- type LogicalBinaryExpression
- type NaturalJoin
- type Node
- type NodeLocation
- type OrderBy
- type OrderType
- type QualifiedName
- type Query
- type QueryBody
- type QuerySpecification
- type Relation
- type Select
- type SelectItem
- type SimpleGroupBy
- type SingleColumn
- type SortItem
- type Statement
- type Table
- type TableSubquery
- type With
- type WithQuery
Constants ¶
This section is empty.
Variables ¶
var JoinTypes = [...]string{
"CROSS",
"INNER",
"LEFT",
"RIGHT",
"FULL",
"IMPLICIT",
}
JoinTypes is join type strings
var LogicalBinaryExpTypes = [...]string{
"AND",
"OR",
"NOOP",
}
LogicalBinaryExpTypes is logical binary exp type strings
var OrderTypes = [...]string{
"ASC",
"DESC",
}
OrderTypes is order type strings
Functions ¶
This section is empty.
Types ¶
type AliasedRelation ¶
type AliasedRelation struct {
IRelation
Relation IRelation
Alias *Identifier
ColumnNames []*Identifier
}
AliasedRelation is alias relation
func NewAliasedRelation ¶
func NewAliasedRelation( location *NodeLocation, relation IRelation, alias *Identifier, columns []*Identifier) *AliasedRelation
NewAliasedRelation creates NewAliasedRelation
func (*AliasedRelation) Accept ¶
func (n *AliasedRelation) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type AllColumns ¶
type AllColumns struct {
// SelectItem is ISelectItem
ISelectItem
// Prefix is QualifiedName
Prefix *QualifiedName
}
AllColumns are AllColumns
func NewAllColumns ¶
func NewAllColumns(location *NodeLocation, prefix *QualifiedName) *AllColumns
NewAllColumns creates AllColumns
func (*AllColumns) Accept ¶
func (n *AllColumns) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type AstVisitor ¶
type AstVisitor interface {
// VisitAliasedRelation visits the node
VisitAliasedRelation(aliasedRelation *AliasedRelation, ctx interface{}) interface{}
// VisitAllColumns visits the node
VisitAllColumns(allColumns *AllColumns, ctx interface{}) interface{}
// VisitExpression visits the node
VisitExpression(exp IExpression, ctx interface{}) interface{}
// VisitGroupBy visits the node
VisitGroupBy(groupby *GroupBy, ctx interface{}) interface{}
// VisitExpression visits the node
VisitGroupingElement(groupElement IGroupingElement, ctx interface{}) interface{}
// VisitIdentifier visits the node
VisitIdentifier(identifier *Identifier, ctx interface{}) interface{}
// VisitJoin visits the node
VisitJoin(join *Join, ctx interface{}) interface{}
// VisitLogicalBinaryExpression visits the node
VisitLogicalBinaryExpression(logicalBinaryExpr *LogicalBinaryExpression, ctx interface{}) interface{}
// VisitOrderBy visits the node
VisitOrderBy(orderBy *OrderBy, ctx interface{}) interface{}
// VisitQuery visits the node
VisitQuery(query *Query, ctx interface{}) interface{}
// VisitQueryBody visits the node
VisitQueryBody(queryBody IQueryBody, ctx interface{}) interface{}
// VisitQuerySpecification visits the node
VisitQuerySpecification(querySpec *QuerySpecification, ctx interface{}) interface{}
// VisitRelation visits the node
VisitRelation(relation IRelation, ctx interface{}) interface{}
// VisitSelect visits the node
VisitSelect(sel *Select, ctx interface{}) interface{}
// VisitSelectItem visits the node
VisitSelectItem(selectItem ISelectItem, ctx interface{}) interface{}
// VisitSimpleGroupBy visits the node
VisitSimpleGroupBy(simpleGroupBy *SimpleGroupBy, ctx interface{}) interface{}
// VisitSingleColumn visits the node
VisitSingleColumn(singleColumn *SingleColumn, ctx interface{}) interface{}
// VisitSortItem visits the node
VisitSortItem(sortItem *SortItem, ctx interface{}) interface{}
// VisitStatement visits the node
VisitStatement(statement IStatement, ctx interface{}) interface{}
// VisitTable visits the node
VisitTable(table *Table, ctx interface{}) interface{}
// VisitTableSubquery visits the node
VisitTableSubquery(tableSubquery *TableSubquery, ctx interface{}) interface{}
// VisitWith visits the node
VisitWith(with *With, ctx interface{}) interface{}
// VisitWithQuery visits the node
VisitWithQuery(with *WithQuery, ctx interface{}) interface{}
// contains filtered or unexported methods
}
AstVisitor is a visitor
type Expression ¶
type Expression struct {
// Node is an INode
*Node
}
Expression is an IExpression
func NewExpression ¶
func NewExpression(location *NodeLocation) *Expression
NewExpression creates Expression
func (*Expression) Accept ¶
func (e *Expression) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type GroupBy ¶
type GroupBy struct {
// Node is INode
INode
IsDistinct bool
GroupingElements []IGroupingElement
}
GroupBy is GroupBy
func NewGroupBy ¶
func NewGroupBy(location *NodeLocation, distinct bool, elements []IGroupingElement) *GroupBy
NewGroupBy creates GroupBy
func (*GroupBy) Accept ¶
func (e *GroupBy) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type GroupingElement ¶
type GroupingElement struct {
// Node is INode
INode
}
GroupingElement is IGroupingElement
func NewGroupingElement ¶
func NewGroupingElement(location *NodeLocation) *GroupingElement
NewGroupingElement creates GroupingElement
func (*GroupingElement) Accept ¶
func (g *GroupingElement) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type IExpression ¶
type IExpression interface {
// INode is interface
INode
}
IExpression is interface
type IGroupingElement ¶
type IGroupingElement interface {
// INode is interface
INode
}
IGroupingElement is interface
type IJoinCriteria ¶
type IJoinCriteria interface {
// GetNodes returns the list of nodes
GetNodes() []INode
}
IJoinCriteria is interface
type INode ¶
type INode interface {
SetValue(value string)
GetValue() string
Accept(visitor AstVisitor, ctx interface{}) interface{}
}
INode is interface
type IQueryBody ¶
type IQueryBody interface {
// IRelation is interface
IRelation
}
IQueryBody is interface
type ISelectItem ¶
type ISelectItem interface {
// INode is interface
INode
}
ISelectItem is interface
type Identifier ¶
type Identifier struct {
// Expression is IExpression
IExpression
// Value is Identifier text
Value string
// Delimited is flag
Delimited bool
}
Identifier is Identifier
func NewIdentifier ¶
func NewIdentifier(location *NodeLocation, value string, delimited bool) *Identifier
NewIdentifier creates Identifier
func (*Identifier) Accept ¶
func (e *Identifier) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type Join ¶
type Join struct {
// IRelation is interface
IRelation
// Type is join type
Type JoinType
// Left is IRelation
Left IRelation
// Right is IRelation
Right IRelation
// Criteria is on condition
Criteria IJoinCriteria
}
Join is Join
func NewJoin ¶
func NewJoin(location *NodeLocation, joinType JoinType, left, right IRelation, criteria IJoinCriteria) *Join
NewJoin creates Join
func (*Join) Accept ¶
func (e *Join) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type JoinOn ¶
type JoinOn struct {
// IJoinCriteria is interface
IJoinCriteria
Expr IExpression
}
JoinOn is natural join
type JoinUsing ¶
type JoinUsing struct {
// IJoinCriteria is interface
IJoinCriteria
Columns []*Identifier
}
JoinUsing is natural join
func NewJoinUsing ¶
func NewJoinUsing(columns []*Identifier) *JoinUsing
NewJoinUsing creates JoinUsing
type LogicalBinaryExpType ¶
type LogicalBinaryExpType int
LogicalBinaryExpType is logical binary exp type
const ( // AND is logic AND LogicalBinaryExpType = iota // OR is logic OR // NOOP is logic NOOP )
type LogicalBinaryExpression ¶
type LogicalBinaryExpression struct {
IExpression
LogicType LogicalBinaryExpType
Left IExpression
Right IExpression
}
LogicalBinaryExpression is IExpression
func NewLogicalBinaryExpression ¶
func NewLogicalBinaryExpression(location *NodeLocation, logicType LogicalBinaryExpType, left, right IExpression) *LogicalBinaryExpression
NewLogicalBinaryExpression creates LogicalBinaryExpression
func (*LogicalBinaryExpression) Accept ¶
func (e *LogicalBinaryExpression) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type NaturalJoin ¶
type NaturalJoin struct {
// IJoinCriteria is interface
IJoinCriteria
}
NaturalJoin is natural join
type Node ¶
type Node struct {
// Location is node location
Location *NodeLocation
// contains filtered or unexported fields
}
Node is INode
func (*Node) Accept ¶
func (n *Node) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type NodeLocation ¶
NodeLocation is position
type OrderBy ¶
type OrderBy struct {
// Node is INode
INode
// SortItems is list of SortItems
SortItems []*SortItem
}
OrderBy is OrderBy
func NewOrderBy ¶
func NewOrderBy(location *NodeLocation, sortItems []*SortItem) *OrderBy
NewOrderBy creates OrderBy
func (*OrderBy) Accept ¶
func (n *OrderBy) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type QualifiedName ¶
type QualifiedName struct {
// Parts is list of string
Parts []string
// OriginalParts is list of string
OriginalParts []string
}
QualifiedName is column QualifiedName
func NewQualifiedName ¶
func NewQualifiedName(originalParts, parts []string) *QualifiedName
NewQualifiedName creates QualifiedName
type Query ¶
type Query struct {
// Statement is IStatement
IStatement
// QueryBody is IQueryBody
QueryBody IQueryBody
// With is with
With *With
// OrderBy is orderby
OrderBy *OrderBy
// Limit is limit
Limit string
}
Query is query
func NewQuery ¶
func NewQuery(location *NodeLocation, with *With, queryBody IQueryBody, order *OrderBy, limit string) *Query
NewQuery creates Query
func (*Query) Accept ¶
func (n *Query) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type QueryBody ¶
type QueryBody struct {
IRelation
}
QueryBody is QueryBody
func NewQueryBody ¶
func NewQueryBody(location *NodeLocation) *QueryBody
NewQueryBody creates QueryBody
func (*QueryBody) Accept ¶
func (q *QueryBody) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type QuerySpecification ¶
type QuerySpecification struct {
// QueryBody is IQueryBody
IQueryBody
// Select is Select
Select *Select
// From is IRelation
From IRelation
// Where is IExpression
Where IExpression
// GroupBy is GroupBy
GroupBy *GroupBy
// Having is IExpression
Having IExpression
// OrderBy is OrderBy
OrderBy *OrderBy
// Limit is limit
Limit string
}
QuerySpecification is QuerySpecification
func NewQuerySpecification ¶
func NewQuerySpecification(location *NodeLocation, sel *Select, from IRelation, where IExpression, groupBy *GroupBy, having IExpression, orderBy *OrderBy, limit string) *QuerySpecification
NewQuerySpecification creates QuerySpecification
func (*QuerySpecification) Accept ¶
func (e *QuerySpecification) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type Relation ¶
type Relation struct {
INode
}
Relation is IRelation
func (*Relation) Accept ¶
func (r *Relation) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type Select ¶
type Select struct {
// Node is INode
INode
// Distinct is distinct
Distinct bool
// SelectItems is list of ISelectItems
SelectItems []ISelectItem
}
Select is select
func NewSelect ¶
func NewSelect(location *NodeLocation, distinct bool, selectItems []ISelectItem) *Select
NewSelect creates Select
func (*Select) Accept ¶
func (r *Select) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type SelectItem ¶
type SelectItem struct {
// Node is INode
INode
}
SelectItem is SelectItem
func NewSelectItem ¶
func NewSelectItem(location *NodeLocation) *SelectItem
NewSelectItem creates SelectItem
func (*SelectItem) Accept ¶
func (r *SelectItem) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type SimpleGroupBy ¶
type SimpleGroupBy struct {
IGroupingElement
// Columns is group by columns
Columns []IExpression
}
SimpleGroupBy is group by
func NewSimpleGroupBy ¶
func NewSimpleGroupBy(location *NodeLocation, expressions []IExpression) *SimpleGroupBy
NewSimpleGroupBy creates SimpleGroupBy
func (*SimpleGroupBy) Accept ¶
func (q *SimpleGroupBy) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type SingleColumn ¶
type SingleColumn struct {
// SelectItem is interface
ISelectItem
// Alias is column alias
Alias *Identifier
// Expression is IExpression
Expression IExpression
}
SingleColumn is select SingleColumn
func NewSingleColumn ¶
func NewSingleColumn(location *NodeLocation, expr IExpression, alias *Identifier) *SingleColumn
NewSingleColumn creates SingleColumn
func (*SingleColumn) Accept ¶
func (q *SingleColumn) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type SortItem ¶
type SortItem struct {
// Node is INode
INode
Expr IExpression
Order OrderType
}
SortItem is SortItem
func NewSortItem ¶
func NewSortItem(location *NodeLocation, expr IExpression, order OrderType) *SortItem
NewSortItem creates SortItem
func (*SortItem) Accept ¶
func (q *SortItem) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type Statement ¶
type Statement struct {
// Node is INode
INode
}
Statement is Statement
func NewStatement ¶
func NewStatement(location *NodeLocation) *Statement
NewStatement creates Statement
func (*Statement) Accept ¶
func (q *Statement) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type Table ¶
type Table struct {
IQueryBody
// Name is table name
Name *QualifiedName
}
Table is table name
func NewTable ¶
func NewTable(location *NodeLocation, name *QualifiedName) *Table
NewTable creates table name
func (*Table) Accept ¶
func (q *Table) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type TableSubquery ¶
type TableSubquery struct {
IQueryBody
// Query is subquery
Query *Query
}
TableSubquery is subquery
func NewTableSubquery ¶
func NewTableSubquery(location *NodeLocation, query *Query) *TableSubquery
NewTableSubquery creates TableSubquery
func (*TableSubquery) Accept ¶
func (q *TableSubquery) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type With ¶
type With struct {
// Node is INode
INode
// Recursive is with Recursive
Recursive bool
// Queries is WithQuery
Queries []*WithQuery
}
With is With
func NewWith ¶
func NewWith(location *NodeLocation, recursive bool, queries []*WithQuery) *With
NewWith creates With
func (*With) Accept ¶
func (n *With) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
type WithQuery ¶
type WithQuery struct {
// Node is INode
INode
// Name is name
Name *Identifier
// Query is query
Query *Query
// ColumnAliases is ColumnAliases
ColumnAliases []*Identifier
}
WithQuery is WithQuery
func NewWithQuery ¶
func NewWithQuery(location *NodeLocation, name *Identifier, query *Query, columnAliases []*Identifier) *WithQuery
NewWithQuery creates WithQuery
func (*WithQuery) Accept ¶
func (q *WithQuery) Accept(visitor AstVisitor, ctx interface{}) interface{}
Accept accepts visitor
Source Files
¶
- AliasedRelation.go
- AllColumns.go
- AstVisitor.go
- Expression.go
- GroupBy.go
- GroupingElement.go
- Identifier.go
- Join.go
- JoinCriteria.go
- JoinOn.go
- JoinUsing.go
- LogicalBinaryExpression.go
- NaturalJoin.go
- Node.go
- OrderBy.go
- QualifiedName.go
- Query.go
- QueryBody.go
- QuerySpecification.go
- Relation.go
- Select.go
- SelectItem.go
- SimpleGroupBy.go
- SingleColumn.go
- SortItem.go
- Statement.go
- Table.go
- TableSubquery.go
- With.go
- WithQuery.go