Documentation ¶
Index ¶
- Variables
- type PlayerDTO
- type RosterConfiguration
- type RosterService
- func (s *RosterService) AddPlayer(player entity.Person) error
- func (s *RosterService) AddTeam(team entity.Group) error
- func (s *RosterService) AssignPlayerToTeam(team entity.Group, player entity.Person) error
- func (s *RosterService) GetPlayer(player entity.Person) (PlayerDTO, error)
- func (s *RosterService) GetTeam(team entity.Group) (TeamDTO, error)
- func (s *RosterService) UnassignPlayerFromTeam(team entity.Group, player entity.Person) error
- type TeamDTO
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidRosterConfig = errors.New("services: invalid roster configuration")
var RosterConfigs = []RosterConfiguration{ WithMemoryRepositories(), }
RosterConfigs defines the configurations to intialize the service with.
Functions ¶
This section is empty.
Types ¶
type PlayerDTO ¶
func NewPlayerDTO ¶
type RosterConfiguration ¶
type RosterConfiguration func(s *RosterService) error
RosterConfiguration is a function that modifies the service.
func WithMemoryRepositories ¶
func WithMemoryRepositories() RosterConfiguration
WithMemoryRepositories attaches in memory repostories to service.
type RosterService ¶
type RosterService struct {
// contains filtered or unexported fields
}
RosterService is a implementation of the RosterService.
func NewRosterService ¶
func NewRosterService() (*RosterService, error)
NewRosterService accepts configs and returns a new service.
func (*RosterService) AddPlayer ¶
func (s *RosterService) AddPlayer(player entity.Person) error
AddPlayer initializes a new player to the repository if valid.
func (*RosterService) AddTeam ¶
func (s *RosterService) AddTeam(team entity.Group) error
AddTeam initializes a new team to the repository if valid.
func (*RosterService) AssignPlayerToTeam ¶
AssignPlayerToTeam assigns player to team's roster.
func (*RosterService) GetPlayer ¶
func (s *RosterService) GetPlayer(player entity.Person) (PlayerDTO, error)
GetPlayer retrieves the players based on person entity.
func (*RosterService) GetTeam ¶
func (s *RosterService) GetTeam(team entity.Group) (TeamDTO, error)
GetTeam retrieves the team model based on group entity.
func (*RosterService) UnassignPlayerFromTeam ¶
UnassignPlayerToTeam unassigns player from team's roster.