Skip to content

Commit

Permalink
select as
Browse files Browse the repository at this point in the history
  • Loading branch information
folospace committed Nov 11, 2024
1 parent b9b017b commit b0783ac
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions orm/query_select.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ func (q *Query[T]) Select(columns ...any) *Query[T] {
return q
}

func (q *Query[T]) SelectAs(column any, as string) *Query[T] {
colStr, err := q.generateSelectColumns(column)
q.setErr(err)
q.columns = append(q.columns, colStr+" as "+as)
return q
}

func (q *Query[T]) SelectExclude(exceptColumns ...any) *Query[T] {
q.columns = nil

Expand Down

0 comments on commit b0783ac

Please sign in to comment.