Default aliasing simplified.

This commit is contained in:
go-jet 2019-06-09 11:06:08 +02:00
parent e772768180
commit ffba8718ca
11 changed files with 46 additions and 70 deletions

View file

@ -11,27 +11,13 @@ type ColumnList []Column
func (cl ColumnList) isProjectionType() {}
func (cl ColumnList) serializeForProjection(statement statementType, out *queryData) error {
for i, column := range cl {
err := column.serializeForProjection(statement, out)
projections := columnListToProjectionList(cl)
if err != nil {
return err
}
err := serializeProjectionList(statement, projections, out)
if i != len(cl)-1 {
out.writeString(", ")
}
if err != nil {
return err
}
return nil
}
func (cl ColumnList) DefaultAlias() []projection {
newColumnList := []projection{}
for _, column := range cl {
newColumn := column.defaultAliasProjection()
newColumnList = append(newColumnList, newColumn)
}
return newColumnList
}