selectTerms appends the select terms to the joined query. Afterward, the term aliases are utilized to order the root query.
(q *sql.Selector, ts []sql.OrderTerm)
| 503 | // selectTerms appends the select terms to the joined query. |
| 504 | // Afterward, the term aliases are utilized to order the root query. |
| 505 | func selectTerms(q *sql.Selector, ts []sql.OrderTerm) { |
| 506 | for _, t := range ts { |
| 507 | switch t := t.(type) { |
| 508 | case *sql.OrderFieldTerm: |
| 509 | if t.As != "" { |
| 510 | q.AppendSelectAs(q.C(t.Field), t.As) |
| 511 | } else { |
| 512 | q.AppendSelect(q.C(t.Field)) |
| 513 | } |
| 514 | case *sql.OrderExprTerm: |
| 515 | q.AppendSelectExprAs(t.Expr(q), t.As) |
| 516 | } |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | // OrderByNeighborTerms appends ordering based on the number of neighbors. |
| 521 | // For example, order users by their number of posts. |
no test coverage detected
searching dependent graphs…