Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for GroupByAppend #275

Closed
3 tasks done
ashishkf opened this issue May 21, 2021 · 2 comments
Closed
3 tasks done

Add support for GroupByAppend #275

ashishkf opened this issue May 21, 2021 · 2 comments
Assignees

Comments

@ashishkf
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Unlike Select, Order, GroupBy have only GroupBy and SetGroupBy but not GroupByAppend.
Without this, we cannot add additional group by clauses - we need to get existing ones, do the append outside and then call SetGroupBy.

Describe the solution you'd like
A method on selectClauses GroupByAppend as follows:

func (c *selectClauses) GroupByAppend(cl ColumnListExpression) SelectClauses {
     ret := c.clone()
    ret.groupBy = ret.groupBy.Append(cl.Columns()...)
   return ret
}

Also, corresponding method on SelectDataset as follows:

func (sd *SelectDataset) GroupByAppend(groupBy ...interface{}) *SelectDataset {
   return sd.copy(sd.clauses.GroupByAppend(exp.NewColumnListExpression(groupBy...)))
}

Dialect

  • postgres
  • mysql
  • sqlite3
@ashishkf
Copy link
Contributor Author

#276

@doug-martin
Copy link
Owner

Released in v9.14.0 thank you for your PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants