Skip to content

Commit

Permalink
Oper: move the Sort calling into Select
Browse files Browse the repository at this point in the history
  • Loading branch information
xgfone committed Jan 6, 2025
1 parent 50bdf53 commit f96bcd6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dml_oper.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func (o Oper[T]) GetRow(columns any, conds ...op.Condition) Row {

// GetRowContext builds a SELECT statement and returns a Row.
func (o Oper[T]) GetRowContext(ctx context.Context, columns any, conds ...op.Condition) Row {
return o.Select(columns, conds...).Sort(o.Sorter).QueryRowContext(ctx)
return o.Select(columns, conds...).QueryRowContext(ctx)
}

// GetRows is equal to o.GetRowsContext(context.Background(), columns, page, conds...).
Expand All @@ -221,7 +221,7 @@ func (o Oper[T]) GetRows(columns any, page op.Pagination, conds ...op.Condition)

// GetRowsContext builds a SELECT statement and returns a Rows.
func (o Oper[T]) GetRowsContext(ctx context.Context, columns any, page op.Pagination, conds ...op.Condition) Rows {
return o.Select(columns, conds...).Pagination(page).Sort(o.Sorter).QueryRowsContext(ctx)
return o.Select(columns, conds...).Pagination(page).QueryRowsContext(ctx)
}

// Query is equal to o.QueryContext(context.Background(), page, pageSize, conds...).
Expand Down Expand Up @@ -349,7 +349,7 @@ func (o Oper[T]) Select(columns any, conds ...op.Condition) *SelectBuilder {
}

q.binder = o.binder
return q.Where(conds...)
return q.Sort(o.Sorter).Where(conds...)
}

/// ----------------------------------------------------------------------- ///
Expand Down

0 comments on commit f96bcd6

Please sign in to comment.