MCPcopy
hub / github.com/redis/go-redis / BatchAdd

Method BatchAdd

internal/routing/aggregator.go:239–256  ·  view source on GitHub ↗
(results map[string]AggregatorResErr)

Source from the content-addressed store, hash-verified

237}
238
239func (a *AggSumAggregator) BatchAdd(results map[string]AggregatorResErr) error {
240 var sum int64
241
242 for _, res := range results {
243 if res.Err != nil {
244 return a.Add(res.Result, res.Err)
245 }
246
247 intRes, err := toInt64(res.Result)
248 if err != nil {
249 return a.Add(nil, err)
250 }
251
252 sum += intRes
253 }
254
255 return a.Add(sum, nil)
256}
257
258func (a *AggSumAggregator) AddWithKey(key string, result interface{}, err error) error {
259 return a.Add(result, err)

Callers

nothing calls this directly

Calls 2

AddMethod · 0.95
toInt64Function · 0.70

Tested by

no test coverage detected