func (self *YesOrNo) Rollup(time int64, key string, samples *vector.IntVector) { data := &YesOrNoItem{} samples.Do(func(elem interface{}) { value := elem.(int) if value > 0 { data.ok++ } else { data.fail++ } }) self.save(time, key, data) }