roster

package
v0.0.0-...-61e3c9a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidRosterConfig = errors.New("services: invalid roster configuration")

Functions

This section is empty.

Types

type PlayerDTO

type PlayerDTO struct {
	Entity core.Person
	Teams  []core.Group
}

PlayerDTO is a data transfer object of a player.

func NewPlayerDTO

func NewPlayerDTO(p *player.Player) PlayerDTO

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.

type TeamDTO

type TeamDTO struct {
	Entity  core.Group
	Players []core.Person
}

TeamDTO is a data transfer object of a team.

func NewTeamDTO

func NewTeamDTO(t *team.Team) TeamDTO

NewTeamDTO creates a team DTO.

Directories

Path Synopsis
domain
infrastructure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL