diff options
Diffstat (limited to 'internal/quorum/score.go')
| -rw-r--r-- | internal/quorum/score.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/internal/quorum/score.go b/internal/quorum/score.go new file mode 100644 index 0000000..d67b791 --- /dev/null +++ b/internal/quorum/score.go @@ -0,0 +1,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 +} |
