-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into movement-depending-on-time-instead-of-ticks
- Loading branch information
Showing
41 changed files
with
1,055 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
defmodule Configurator.Configuration do | ||
@moduledoc """ | ||
The Configuration context. | ||
""" | ||
|
||
import Ecto.Query, warn: false | ||
alias Configurator.Repo | ||
|
||
alias Configurator.Configuration.Character | ||
|
||
@doc """ | ||
Returns the list of characters. | ||
## Examples | ||
iex> list_characters() | ||
[%Character{}, ...] | ||
""" | ||
def list_characters do | ||
Repo.all(Character) | ||
end | ||
|
||
@doc """ | ||
Gets a single character. | ||
Raises `Ecto.NoResultsError` if the Character does not exist. | ||
## Examples | ||
iex> get_character!(123) | ||
%Character{} | ||
iex> get_character!(456) | ||
** (Ecto.NoResultsError) | ||
""" | ||
def get_character!(id), do: Repo.get!(Character, id) | ||
|
||
@doc """ | ||
Creates a character. | ||
## Examples | ||
iex> create_character(%{field: value}) | ||
{:ok, %Character{}} | ||
iex> create_character(%{field: bad_value}) | ||
{:error, %Ecto.Changeset{}} | ||
""" | ||
def create_character(attrs \\ %{}) do | ||
%Character{} | ||
|> Character.changeset(attrs) | ||
|> Repo.insert() | ||
end | ||
|
||
@doc """ | ||
Updates a character. | ||
## Examples | ||
iex> update_character(character, %{field: new_value}) | ||
{:ok, %Character{}} | ||
iex> update_character(character, %{field: bad_value}) | ||
{:error, %Ecto.Changeset{}} | ||
""" | ||
def update_character(%Character{} = character, attrs) do | ||
character | ||
|> Character.changeset(attrs) | ||
|> Repo.update() | ||
end | ||
|
||
@doc """ | ||
Deletes a character. | ||
## Examples | ||
iex> delete_character(character) | ||
{:ok, %Character{}} | ||
iex> delete_character(character) | ||
{:error, %Ecto.Changeset{}} | ||
""" | ||
def delete_character(%Character{} = character) do | ||
Repo.delete(character) | ||
end | ||
|
||
@doc """ | ||
Returns an `%Ecto.Changeset{}` for tracking character changes. | ||
## Examples | ||
iex> change_character(character) | ||
%Ecto.Changeset{data: %Character{}} | ||
""" | ||
def change_character(%Character{} = character, attrs \\ %{}) do | ||
Character.changeset(character, attrs) | ||
end | ||
end |
Oops, something went wrong.