-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
83 lines (70 loc) · 3.28 KB
/
main.go
File metadata and controls
83 lines (70 loc) · 3.28 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package multielo
import (
domain "github.com/distrobyte/multielo/domain"
"github.com/distrobyte/multielo/infrastructure"
)
type ErrorType = domain.ErrorType
type ELOError = domain.ELOError
var (
ErrInvalidPlayerName = domain.ErrInvalidPlayerName
ErrPlayerAlreadyExists = domain.ErrPlayerAlreadyExists
ErrPlayerNotFound = domain.ErrPlayerNotFound
ErrELOOutOfBounds = domain.ErrELOOutOfBounds
ErrInvalidPosition = domain.ErrInvalidPosition
ErrInvalidMatch = domain.ErrInvalidMatch
ErrLeagueFull = domain.ErrLeagueFull
ErrNoPlayers = domain.ErrNoPlayers
)
const (
ErrorTypeValidation = domain.ErrorTypeValidation
ErrorTypeNotFound = domain.ErrorTypeNotFound
ErrorTypePlayerNotFound = domain.ErrorTypePlayerNotFound
ErrorTypePlayerExists = domain.ErrorTypePlayerExists
ErrorTypeConflict = domain.ErrorTypeConflict
ErrorTypeInternal = domain.ErrorTypeInternal
)
type LeagueConfig = domain.LeagueConfig
func DefaultConfig() LeagueConfig { return domain.DefaultConfig() }
type Validator = domain.Validator
type DefaultValidator = domain.DefaultValidator
func NewDefaultValidator(cfg LeagueConfig) *DefaultValidator { return domain.NewDefaultValidator(cfg) }
type Player = domain.Player
type PlayerStats = domain.PlayerStats
type Match = domain.Match
type MatchResult = domain.MatchResult
type MatchDiff = domain.MatchDiff
type League = domain.League
type LeagueDependencies = domain.LeagueDependencies
type LeagueCommands = domain.LeagueCommands
type LeagueQueries = domain.LeagueQueries
type LeagueService = domain.LeagueService
type ELOCalculator = domain.ELOCalculator
type Logger = domain.Logger
type MetricsRecorder = domain.MetricsRecorder
type ArchiveCallback = domain.ArchiveCallback
type MultiLeagueService = domain.MultiLeagueService
type MatchFilter = domain.MatchFilter
type MatchQueryResult = domain.MatchQueryResult
type GraphRenderer = domain.GraphRenderer
type LastChange = domain.LastChange
func NewLeague() *League { return domain.NewLeague() }
func NewLeagueWithConfig(cfg LeagueConfig) *League { return domain.NewLeagueWithConfig(cfg) }
func NewLeagueWithDependencies(cfg LeagueConfig, deps LeagueDependencies) *League {
return domain.NewLeagueWithDependencies(cfg, deps)
}
func NewLeagueService(league *League) *LeagueService { return domain.NewLeagueService(league) }
func NewMultiLeagueService(cfg LeagueConfig, deps LeagueDependencies) *MultiLeagueService {
return domain.NewMultiLeagueService(cfg, deps)
}
func NewPlayer(name string, cfg LeagueConfig) (*Player, error) { return domain.NewPlayer(name, cfg) }
func NewHTMLGraphRenderer() GraphRenderer { return infrastructure.NewHTMLGraphRenderer() }
func NewGraphRenderer() GraphRenderer { return infrastructure.NewGraphRenderer() }
func NewMultiGraphRenderer() GraphRenderer { return infrastructure.NewMultiGraphRenderer() }
func SetGraphRenderer(r GraphRenderer) { domain.SetGraphRenderer(r) }
func SyncPlayerHistories(league *League) { league.SyncPlayerHistories() }
func GetLastChanges(league *League) []LastChange { return league.GetLastChanges() }
const InitialELO = 1000
func init() {
// Default: generate HTML + PNG/SVG using a composite renderer.
domain.SetGraphRenderer(infrastructure.NewMultiGraphRenderer())
}