Documentation ¶
Index ¶
- Variables
- type PlayerDTO
- type RosterApplication
- func (s *RosterApplication) AddPlayer(playerEntity core.Person) (PlayerDTO, error)
- func (s *RosterApplication) AddTeam(name string) (TeamDTO, error)
- func (s *RosterApplication) AssignPlayerToTeam(teamEntity core.Group, playerEntity core.Person) error
- func (s *RosterApplication) GetPlayer(playerEntity core.Person) (PlayerDTO, error)
- func (s *RosterApplication) GetTeam(teamEntity core.Group) (TeamDTO, error)
- func (s *RosterApplication) UnassignPlayerFromTeam(teamEntity core.Group, playerEntity core.Person) error
- type RosterConfig
- type TeamDTO
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidRosterConfig = errors.New("services: invalid roster configuration")
Functions ¶
This section is empty.
Types ¶
type PlayerDTO ¶
PlayerDTO is a data transfer object of a player.
func NewPlayerDTO ¶
NewPlayerDTO creates a player DTO.
type RosterApplication ¶
type RosterApplication struct {
// contains filtered or unexported fields
}
RosterApplication holds all services related to roster management.
func NewRosterApplication ¶
func NewRosterApplication(cfgs []RosterConfig) (*RosterApplication, error)
NewRosterApplication intitializes the roster application.
func (*RosterApplication) AddPlayer ¶
func (s *RosterApplication) AddPlayer(playerEntity core.Person) (PlayerDTO, error)
AddPlayer initializes a new player to the repository if valid.
func (*RosterApplication) AddTeam ¶
func (s *RosterApplication) AddTeam(name string) (TeamDTO, error)
AddTeam initializes a new team to the repository if valid.
func (*RosterApplication) AssignPlayerToTeam ¶
func (s *RosterApplication) AssignPlayerToTeam(teamEntity core.Group, playerEntity core.Person) error
AssignPlayerToTeam assigns player to team's roster.
func (*RosterApplication) GetPlayer ¶
func (s *RosterApplication) GetPlayer(playerEntity core.Person) (PlayerDTO, error)
GetPlayer retrieves the players based on person core.
func (*RosterApplication) GetTeam ¶
func (s *RosterApplication) GetTeam(teamEntity core.Group) (TeamDTO, error)
GetTeam retrieves the team model based on group core.
func (*RosterApplication) UnassignPlayerFromTeam ¶
func (s *RosterApplication) UnassignPlayerFromTeam(teamEntity core.Group, playerEntity core.Person) error
UnassignPlayerToTeam unassigns player from team's roster.
type RosterConfig ¶
type RosterConfig func(s *RosterApplication) error
RosterConfig is a function that modifies the service.
func WithMemoryRepositories ¶
func WithMemoryRepositories() RosterConfig
WithMemoryRepositories attaches in memory repostories to service.