Skip to content

Commit b0783ac

Browse files
committed
select as
1 parent b9b017b commit b0783ac

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

orm/query_select.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ func (q *Query[T]) Select(columns ...any) *Query[T] {
7474
return q
7575
}
7676

77+
func (q *Query[T]) SelectAs(column any, as string) *Query[T] {
78+
colStr, err := q.generateSelectColumns(column)
79+
q.setErr(err)
80+
q.columns = append(q.columns, colStr+" as "+as)
81+
return q
82+
}
83+
7784
func (q *Query[T]) SelectExclude(exceptColumns ...any) *Query[T] {
7885
q.columns = nil
7986

0 commit comments

Comments
 (0)