Extend Table join interface.

This commit is contained in:
sub0Zero 2019-03-15 21:45:10 +01:00 committed by zer0sub
parent 8e57dcc32f
commit ba3cd37734
3 changed files with 78 additions and 7 deletions

View file

@ -26,6 +26,8 @@ type ReadableTable interface {
// Creates a inner join table expression using onCondition.
InnerJoinOn(table ReadableTable, onCondition BoolExpression) ReadableTable
InnerJoinUsing(table ReadableTable, col1 Column, col2 Column) ReadableTable
// Creates a left join table expression using onCondition.
LeftJoinOn(table ReadableTable, onCondition BoolExpression) ReadableTable
@ -170,6 +172,14 @@ func (t *Table) InnerJoinOn(
return InnerJoinOn(t, table, onCondition)
}
func (t *Table) InnerJoinUsing(
table ReadableTable,
col1 Column,
col2 Column) ReadableTable {
return InnerJoinOn(t, table, col1.Eq(col2))
}
// Creates a left join table expression using onCondition.
func (t *Table) LeftJoinOn(
table ReadableTable,
@ -308,6 +318,14 @@ func (t *joinTable) InnerJoinOn(
return InnerJoinOn(t, table, onCondition)
}
func (t *joinTable) InnerJoinUsing(
table ReadableTable,
col1 Column,
col2 Column) ReadableTable {
return InnerJoinOn(t, table, col1.Eq(col2))
}
func (t *joinTable) LeftJoinOn(
table ReadableTable,
onCondition BoolExpression) ReadableTable {