MCPcopy
hub / github.com/ent/ent / ToFunc

Method ToFunc

dialect/sql/sql.go:411–425  ·  view source on GitHub ↗

ToFunc returns a function that sets the ordering on the given selector. This is used by the generated code.

()

Source from the content-addressed store, hash-verified

409// ToFunc returns a function that sets the ordering on the given selector.
410// This is used by the generated code.
411func (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
427func (OrderFieldTerm) term() {}
428func (OrderExprTerm) term() {}

Callers 15

ByIDFunction · 0.80
ByOidFunction · 0.80
ByIDFunction · 0.80
BySourceFunction · 0.80
BySourceURIFunction · 0.80
ByTextFunction · 0.80
ByIDFunction · 0.80
ByMixedStringFunction · 0.80
ByMixedEnumFunction · 0.80
ByActiveFunction · 0.80
ByAgeFunction · 0.80
ByNameFunction · 0.80

Calls 3

OrderExprFuncMethod · 0.80
WriteStringMethod · 0.80
CMethod · 0.65

Tested by

no test coverage detected