-
Notifications
You must be signed in to change notification settings - Fork 2
/
joins.go
30 lines (23 loc) · 851 Bytes
/
joins.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
package sqb
// JoinBuilder to make joins less painfull
type JoinBuilder struct {
Joinable
}
func JB(a Joinable) JoinBuilder {
return JoinBuilder{Joinable: a}
}
func (jb JoinBuilder) LeftJoin(arg Joinable, on OnExpr) JoinBuilder {
return JoinBuilder{Joinable: LeftJoin(jb.Joinable, arg, on)}
}
func (jb JoinBuilder) RightJoin(arg Joinable, on OnExpr) JoinBuilder {
return JoinBuilder{Joinable: RightJoin(jb.Joinable, arg, on)}
}
func (jb JoinBuilder) InnerJoin(arg Joinable, on OnExpr) JoinBuilder {
return JoinBuilder{Joinable: InnerJoin(jb.Joinable, arg, on)}
}
func (jb JoinBuilder) FullOuterJoin(arg Joinable, on OnExpr) JoinBuilder {
return JoinBuilder{Joinable: FullOuterJoin(jb.Joinable, arg, on)}
}
func (jb JoinBuilder) CrossJoin(arg Joinable, on OnExpr) JoinBuilder {
return JoinBuilder{Joinable: CrossJoin(jb.Joinable, arg)}
}