View Source ExTournaments.Match (ExTournaments v0.5.1)

A struct representing a single match in the tournament.

Link to this section Summary

Types

t()

A match

Functions

Converting map to a Match struct

Link to this section Types

@type t() :: %ExTournaments.Match{
  loss: (t() | nil) | nil,
  match: non_neg_integer() | nil,
  player1: non_neg_integer() | nil,
  player2: non_neg_integer() | nil,
  round: non_neg_integer() | nil,
  win: (t() | nil) | nil
}

A match

Link to this section Functions

@spec from_map(map()) :: t()

Converting map to a Match struct

examples

Examples

iex> ExTournaments.Match.from_map(%{ round: 1, match: 1, player1: 1, player2: 2, win: %{

round: 2,
match: 1

}, loss: %{

round: 7,
match: 1

} }) %ExTournaments.Match{ player2: 2, player1: 1, match: 1, round: 1 loss: %ExTournaments.Match{

loss: nil,
win: nil,
player2: nil,
player1: nil,
match: 1,
round: 7

}, win: %ExTournaments.Match{

loss: nil,
win: nil,
player2: nil,
player1: nil,
match: 1,
round: 2

}, }