-
Notifications
You must be signed in to change notification settings - Fork 1
/
select_clause.go
41 lines (30 loc) · 1.16 KB
/
select_clause.go
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package nqb
type SelectClause interface {
Statement
Select(expressions ...interface{}) FromClause
SelectAll(expressions ...interface{}) FromClause
SelectDistinct(expressions ...interface{}) FromClause
SelectRaw(expression interface{}) FromClause
}
type defaultSelectClause struct {
*abstractStatement
}
func newDefaultSelectClause(parent Statement) *defaultSelectClause {
return &defaultSelectClause{&abstractStatement{parent: parent}}
}
func (c *defaultSelectClause) Select(expressions ...interface{}) FromClause {
c.setElement(&selectElement{defaultSelect, toExpressions(expressions...)})
return newDefaultFromClause(c)
}
func (c *defaultSelectClause) SelectAll(expressions ...interface{}) FromClause {
c.setElement(&selectElement{all, toExpressions(expressions...)})
return newDefaultFromClause(c)
}
func (c *defaultSelectClause) SelectDistinct(expressions ...interface{}) FromClause {
c.setElement(&selectElement{distinct, toExpressions(expressions...)})
return newDefaultFromClause(c)
}
func (c *defaultSelectClause) SelectRaw(expression interface{}) FromClause {
c.setElement(&selectElement{raw, []*Expression{X(expression)}})
return newDefaultFromClause(c)
}