MCPcopy
hub / github.com/dgraph-io/dgraph / addCount

Method addCount

query/outputnode.go:1278–1289  ·  view source on GitHub ↗
(enc *encoder, count uint64, dst fastJsonNode)

Source from the content-addressed store, hash-verified

1276}
1277
1278func (sg *SubGraph) addCount(enc *encoder, count uint64, dst fastJsonNode) error {
1279 if sg.Params.Normalize && sg.Params.Alias == "" {
1280 return nil
1281 }
1282 c := types.ValueForType(types.IntID)
1283 c.Value = int64(count)
1284 fieldName := sg.Params.Alias
1285 if fieldName == "" {
1286 fieldName = fmt.Sprintf("count(%s)", sg.Attr)
1287 }
1288 return enc.AddValue(dst, enc.idForAttr(fieldName), c)
1289}
1290
1291func (sg *SubGraph) aggWithVarFieldName() string {
1292 if sg.Params.Alias != "" {

Callers 1

preTraverseMethod · 0.80

Calls 3

ValueForTypeFunction · 0.92
AddValueMethod · 0.80
idForAttrMethod · 0.80

Tested by

no test coverage detected