View Source Teiserver.Game.MatchSettingTypeLib (Teiserver v0.0.4)

TODO: Library of match_setting_type related functions.

Summary

Functions

Returns an %Ecto.Changeset{} for tracking match_setting_type changes.

Creates a match_setting_type.

Deletes a match_setting_type.

Gets the ID of a match_setting_type, if the type doesn't exist it will create the match_setting_type and return the id of that type

Returns the list of match_setting_types.

Functions

Link to this function

change_match_setting_type(match_setting_type, attrs \\ %{})

View Source
@spec change_match_setting_type(Teiserver.Game.MatchSettingType.t(), map()) ::
  Ecto.Changeset.t()

Returns an %Ecto.Changeset{} for tracking match_setting_type changes.

Examples

iex> change_match_setting_type(match_setting_type)
%Ecto.Changeset{data: %MatchSettingType{}}
Link to this function

create_match_setting_type(attrs)

View Source
@spec create_match_setting_type(map()) ::
  {:ok, Teiserver.Game.MatchSettingType.t()} | {:error, Ecto.Changeset.t()}

Creates a match_setting_type.

Examples

iex> create_match_setting_type(%{field: value})
{:ok, %MatchSettingType{}}

iex> create_match_setting_type(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Link to this function

delete_match_setting_type(match_setting_type)

View Source
@spec delete_match_setting_type(Teiserver.Game.MatchSettingType.t()) ::
  {:ok, Teiserver.Game.MatchSettingType.t()} | {:error, Ecto.Changeset.t()}

Deletes a match_setting_type.

Examples

iex> delete_match_setting_type(match_setting_type)
{:ok, %MatchSettingType{}}

iex> delete_match_setting_type(match_setting_type)
{:error, %Ecto.Changeset{}}
Link to this function

get_match_setting_type(match_setting_type_id, query_args \\ [])

View Source

Gets a single match_setting_type.

Returns nil if the MatchSettingType does not exist.

Examples

iex> get_match_setting_type(123)
%MatchSettingType{}

iex> get_match_setting_type(456)
nil
Link to this function

get_match_setting_type!(match_setting_type_id, query_args \\ [])

View Source

Gets a single match_setting_type.

Raises Ecto.NoResultsError if the MatchSettingType does not exist.

Examples

iex> get_match_setting_type!(123)
%MatchSettingType{}

iex> get_match_setting_type!(456)
** (Ecto.NoResultsError)
Link to this function

get_or_create_match_setting_type(name)

View Source
@spec get_or_create_match_setting_type(String.t()) ::
  Teiserver.Game.MatchSettingType.id()

Gets the ID of a match_setting_type, if the type doesn't exist it will create the match_setting_type and return the id of that type

Examples

iex> get_or_create_match_setting_type("existing")
123

iex> get_or_create_match_setting_type("non-existing")
1234
Link to this function

list_match_setting_types(query_args)

View Source
@spec list_match_setting_types(Teiserver.query_args()) :: [
  Teiserver.Game.MatchSettingType.t()
]

Returns the list of match_setting_types.

Examples

iex> list_match_setting_types()
[%MatchSettingType{}, ...]
Link to this function

update_match_setting_type(match_setting_type, attrs)

View Source
@spec update_match_setting_type(Teiserver.Game.MatchSettingType.t(), map()) ::
  {:ok, Teiserver.Game.MatchSettingType.t()} | {:error, Ecto.Changeset.t()}

Updates a match_setting_type.

Examples

iex> update_match_setting_type(match_setting_type, %{field: new_value})
{:ok, %MatchSettingType{}}

iex> update_match_setting_type(match_setting_type, %{field: bad_value})
{:error, %Ecto.Changeset{}}