(results map[string]AggregatorResErr)
| 237 | } |
| 238 | |
| 239 | func (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 | |
| 258 | func (a *AggSumAggregator) AddWithKey(key string, result interface{}, err error) error { |
| 259 | return a.Add(result, err) |