SetTotal godoc upd
Vladimir Bauer
4 years ago
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // SetTotal sets total to an arbitrary value. It's effective only for |
| 182 | // bar which was constructed with `total <= 0` and if | |
| 183 | // (*Bar).EnableTriggerComplete hasn't been called yet. Setting total | |
| 184 | // to negative value is equivalent to (*Bar).SetTotal((*Bar).Current(), | |
| 185 | // bool). If triggerCompleteNow is true then total value is set to | |
| 186 | // current and complete event is triggered right away. | |
| 182 | // bar which was constructed with `total <= 0`. Setting total to negative | |
| 183 | // value is equivalent to (*Bar).SetTotal((*Bar).Current(), bool). | |
| 184 | // If triggerCompleteNow is true, total value is set to current and | |
| 185 | // complete event is triggered right away. | |
| 187 | 186 | func (b *Bar) SetTotal(total int64, triggerCompleteNow bool) { |
| 188 | 187 | select { |
| 189 | 188 | case b.operateState <- func(s *bState) { |