blob: d67b7917b16544452dec59f86e7368f077e98ef3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package quorum
import (
"fmt"
"time"
)
type Score struct {
ID string
Value int
time time.Time
}
func (s Score) Is(other Score) bool {
return s.ID == other.ID && s.Value == other.Value
}
type Scores []Score
func (s Scores) Winner() (Score, error) {
if len(s) == 0 {
return Score{}, fmt.Errorf("emtpy score, no winner")
}
return s[0], nil
}
|