MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / writeOrderAndPage

Function writeOrderAndPage

graphql/dgraph/graphquery.go:236–268  ·  view source on GitHub ↗
(b *strings.Builder, query *dql.GraphQuery, root bool)

Source from the content-addressed store, hash-verified

234}
235
236func writeOrderAndPage(b *strings.Builder, query *dql.GraphQuery, root bool) {
237 var wroteOrder, wroteFirst bool
238
239 for _, ord := range query.Order {
240 if root || wroteOrder {
241 x.Check2(b.WriteString(", "))
242 }
243 if ord.Desc {
244 x.Check2(b.WriteString("orderdesc: "))
245 } else {
246 x.Check2(b.WriteString("orderasc: "))
247 }
248 x.Check2(b.WriteString(ord.Attr))
249 wroteOrder = true
250 }
251
252 if first, ok := query.Args["first"]; ok {
253 if root || wroteOrder {
254 x.Check2(b.WriteString(", "))
255 }
256 x.Check2(b.WriteString("first: "))
257 x.Check2(b.WriteString(first))
258 wroteFirst = true
259 }
260
261 if offset, ok := query.Args["offset"]; ok {
262 if root || wroteOrder || wroteFirst {
263 x.Check2(b.WriteString(", "))
264 }
265 x.Check2(b.WriteString("offset: "))
266 x.Check2(b.WriteString(offset))
267 }
268}

Callers 2

writeQueryFunction · 0.85
writeRootFunction · 0.85

Calls 1

Check2Function · 0.92

Tested by

no test coverage detected