Add ability to exclude columns from ColumnList
This commit is contained in:
parent
3015b79926
commit
555ec293fb
2 changed files with 85 additions and 0 deletions
|
|
@ -11,6 +11,28 @@ func (cl ColumnList) SET(expression Expression) ColumnAssigment {
|
|||
}
|
||||
}
|
||||
|
||||
// Except will create new column list in which columns contained in excluded column names are removed
|
||||
func (cl ColumnList) Except(excludedColumns ...Column) ColumnList {
|
||||
excludedColumnList := UnwidColumnList(excludedColumns)
|
||||
excludedColumnNames := map[string]bool{}
|
||||
|
||||
for _, excludedColumn := range excludedColumnList {
|
||||
excludedColumnNames[excludedColumn.Name()] = true
|
||||
}
|
||||
|
||||
var ret ColumnList
|
||||
|
||||
for _, column := range cl {
|
||||
if excludedColumnNames[column.Name()] {
|
||||
continue
|
||||
}
|
||||
|
||||
ret = append(ret, column)
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (cl ColumnList) fromImpl(subQuery SelectTable) Projection {
|
||||
newProjectionList := ProjectionList{}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue