Skip to content

Commit

Permalink
Allow passing args to Order
Browse files Browse the repository at this point in the history
  • Loading branch information
duckbrain committed Mar 31, 2021
1 parent 46cfd45 commit 69c4818
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions query.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,19 @@ func (q *Query) Where(stmt string, args ...interface{}) *Query {
// Order will append an order clause to the query.
//
// c.Order("name desc")
func (c *Connection) Order(stmt string) *Query {
return Q(c).Order(stmt)
func (c *Connection) Order(stmt string, args ...interface{}) *Query {
return Q(c).Order(stmt, args...)
}

// Order will append an order clause to the query.
//
// q.Order("name desc")
func (q *Query) Order(stmt string) *Query {
func (q *Query) Order(stmt string, args ...interface{}) *Query {
if q.RawSQL.Fragment != "" {
log(logging.Warn, "Query is setup to use raw SQL")
return q
}
q.orderClauses = append(q.orderClauses, clause{stmt, []interface{}{}})
q.orderClauses = append(q.orderClauses, clause{stmt, args})
return q
}

Expand Down

0 comments on commit 69c4818

Please sign in to comment.