forked from chuckpreslar/codex
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect_statement.go
More file actions
27 lines (25 loc) · 1.19 KB
/
select_statement.go
File metadata and controls
27 lines (25 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package codex
// SelectStatement is the base node for SQL Select Statements.
type SelectStatementNode struct {
Table *TableNode // Pointer to the relation the SelectCore is acting on.
Source *JoinSourceNode // JoinSouce for joining other SQL tables.
Cols []interface{} // Cols is an array, normally columns found on the SQL table.
Wheres []interface{} // Wheres is an array of filters for the acting on the SelectCore.
Groups []interface{} // GROUP BY nodes.
Having interface{} // HAVING expression.
Orders []interface{} // An array of nodes for ordering results.
Combinator interface{} // Potential Union/Intersect/Except node.
Limit *LimitNode // Potential Limit node for limiting the number of results returned.
Offset *OffsetNode // Potential Offset node for skipping records.
}
// SelectStatementNode factory method.
func SelectStatement(relation *TableNode) (stm *SelectStatementNode) {
stm = new(SelectStatementNode)
stm.Table = relation
stm.Source = JoinSource(relation)
stm.Wheres = make([]interface{}, 0)
stm.Cols = make([]interface{}, 0)
stm.Groups = make([]interface{}, 0)
stm.Orders = make([]interface{}, 0)
return
}