Add StringColumn type and expression
Add Projection type Alias refactoring More numeric operations
This commit is contained in:
parent
033ab1d0da
commit
b2f84d048c
16 changed files with 350 additions and 199 deletions
|
|
@ -12,18 +12,24 @@ func (s *SelectStatementTable) Columns() []Column {
|
|||
return s.columns
|
||||
}
|
||||
|
||||
func (s *SelectStatementTable) Column(name string) Column {
|
||||
return &baseColumn{
|
||||
name: name,
|
||||
tableName: s.alias,
|
||||
}
|
||||
func (s *SelectStatementTable) RefIntColumnName(name string) Column {
|
||||
intColumn := NewIntegerColumn(name, NotNullable)
|
||||
intColumn.setTableName(s.alias)
|
||||
|
||||
return intColumn
|
||||
}
|
||||
|
||||
func (s *SelectStatementTable) ColumnFrom(column Column) Column {
|
||||
return &baseColumn{
|
||||
name: column.TableName() + "." + column.Name(),
|
||||
tableName: s.alias,
|
||||
}
|
||||
func (s *SelectStatementTable) RefIntColumn(column Column) *IntegerColumn {
|
||||
intColumn := NewIntegerColumn(column.TableName()+"."+column.Name(), NotNullable)
|
||||
intColumn.setTableName(s.alias)
|
||||
|
||||
return intColumn
|
||||
}
|
||||
|
||||
func (s *SelectStatementTable) RefStringColumn(column Column) *StringColumn {
|
||||
strColumn := NewStringColumn(column.Name(), NotNullable)
|
||||
strColumn.setTableName(column.TableName())
|
||||
return strColumn
|
||||
}
|
||||
|
||||
func (s *SelectStatementTable) SerializeSql(out *bytes.Buffer) error {
|
||||
|
|
@ -43,17 +49,17 @@ func (s *SelectStatementTable) SerializeSql(out *bytes.Buffer) error {
|
|||
}
|
||||
|
||||
// Generates a select query on the current tableName.
|
||||
func (s *SelectStatementTable) Select(projections ...Expression) SelectStatement {
|
||||
func (s *SelectStatementTable) SELECT(projections ...Projection) SelectStatement {
|
||||
return newSelectStatement(s, projections)
|
||||
}
|
||||
|
||||
// Creates a inner join tableName expression using onCondition.
|
||||
func (s *SelectStatementTable) InnerJoinOn(table ReadableTable, onCondition BoolExpression) ReadableTable {
|
||||
func (s *SelectStatementTable) INNER_JOIN(table ReadableTable, onCondition BoolExpression) ReadableTable {
|
||||
return InnerJoinOn(s, table, onCondition)
|
||||
}
|
||||
|
||||
//func (s *SelectStatementTable) InnerJoinUsing(table ReadableTable, col1 Column, col2 Column) ReadableTable {
|
||||
// return InnerJoinOn(s, table, col1.Eq(col2))
|
||||
// return INNER_JOIN(s, table, col1.Eq(col2))
|
||||
//}
|
||||
|
||||
// Creates a left join tableName expression using onCondition.
|
||||
|
|
@ -66,7 +72,7 @@ func (s *SelectStatementTable) RightJoinOn(table ReadableTable, onCondition Bool
|
|||
return RightJoinOn(s, table, onCondition)
|
||||
}
|
||||
|
||||
func (s *SelectStatementTable) FullJoin(table ReadableTable, onCondition BoolExpression) ReadableTable {
|
||||
func (s *SelectStatementTable) FULL_JOIN(table ReadableTable, onCondition BoolExpression) ReadableTable {
|
||||
return FullJoin(s, table, onCondition)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue