(enc *encoder, n fastJsonNode, count int)
| 1065 | } |
| 1066 | |
| 1067 | func (sg *SubGraph) handleCountUIDNodes(enc *encoder, n fastJsonNode, count int) (bool, error) { |
| 1068 | addedNewChild := false |
| 1069 | fieldName := sg.fieldName() |
| 1070 | sgFieldID := enc.idForAttr(fieldName) |
| 1071 | for _, child := range sg.Children { |
| 1072 | uidCount := child.Attr == "uid" && child.Params.DoCount && child.IsInternal() |
| 1073 | normWithoutAlias := child.Params.Alias == "" && child.Params.Normalize |
| 1074 | if uidCount && !normWithoutAlias { |
| 1075 | addedNewChild = true |
| 1076 | |
| 1077 | c := types.ValueForType(types.IntID) |
| 1078 | c.Value = int64(count) |
| 1079 | |
| 1080 | field := child.Params.Alias |
| 1081 | if field == "" { |
| 1082 | field = "count" |
| 1083 | } |
| 1084 | |
| 1085 | fjChild := enc.newNode(sgFieldID) |
| 1086 | if err := enc.AddValue(fjChild, enc.idForAttr(field), c); err != nil { |
| 1087 | return false, err |
| 1088 | } |
| 1089 | enc.AddListChild(n, fjChild) |
| 1090 | } |
| 1091 | } |
| 1092 | |
| 1093 | return addedNewChild, nil |
| 1094 | } |
| 1095 | |
| 1096 | func processNodeUids(fj fastJsonNode, enc *encoder, sg *SubGraph) error { |
| 1097 | if sg.Params.IsEmpty { |
no test coverage detected