GameApp.Superheroes (game_app v0.1.0)

The Superheroes context.

Summary

Functions

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

Creates a superhero.

Deletes a superhero.

Gets a single superhero.

Returns the list of superhero.

Returns the list of superheroes.

Updates a superhero.

Functions

Link to this function

change_superhero(superhero, attrs \\ %{})

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

Examples

iex> change_superhero(superhero)
%Ecto.Changeset{data: %Superhero{}}
Link to this function

create_superhero(attrs \\ %{})

Creates a superhero.

Examples

iex> create_superhero(%{field: value})
{:ok, %Superhero{}}

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

delete_superhero(superhero)

Deletes a superhero.

Examples

iex> delete_superhero(superhero)
{:ok, %Superhero{}}

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

get_superhero!(id)

Gets a single superhero.

Raises Ecto.NoResultsError if the Superhero does not exist.

Examples

iex> get_superhero!(123)
%Superhero{}

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

list_superhero()

Returns the list of superhero.

Examples

iex> list_superhero()
[%Superhero{}, ...]
Link to this function

list_superheroes()

Returns the list of superheroes.

Examples

iex> list_superheroes()
[%Superhero{}, ...]
Link to this function

update_superhero(superhero, attrs)

Updates a superhero.

Examples

iex> update_superhero(superhero, %{field: new_value})
{:ok, %Superhero{}}

iex> update_superhero(superhero, %{field: bad_value})
{:error, %Ecto.Changeset{}}