ToFunc returns a function that sets the ordering on the given selector. This is used by the generated code.
()
| 409 | // ToFunc returns a function that sets the ordering on the given selector. |
| 410 | // This is used by the generated code. |
| 411 | func (f *OrderFieldTerm) ToFunc() func(*Selector) { |
| 412 | return func(s *Selector) { |
| 413 | s.OrderExprFunc(func(b *Builder) { |
| 414 | b.WriteString(s.C(f.Field)) |
| 415 | if f.Desc { |
| 416 | b.WriteString(" DESC") |
| 417 | } |
| 418 | if f.NullsFirst { |
| 419 | b.WriteString(" NULLS FIRST") |
| 420 | } else if f.NullsLast { |
| 421 | b.WriteString(" NULLS LAST") |
| 422 | } |
| 423 | }) |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | func (OrderFieldTerm) term() {} |
| 428 | func (OrderExprTerm) term() {} |
no test coverage detected