udia v0.1.3 Udia.Accounts View Source

The boundary for the Accounts system.

Link to this section Summary

Functions

Creates a user

Deletes a User

Gets a single user

Gets a single user

Returns the list of users

Updates a user (only allow change password)

Link to this section Functions

Link to this function create_user(attrs \\ %{}) View Source

Creates a user.

Examples

iex> create_user(%{field: value})
{:ok, %User{}}

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

Deletes a User.

Examples

iex> delete_user(user)
{:ok, %User{}}

iex> delete_user(user)
{:error, %Ecto.Changeset{}}

Gets a single user.

Raises Ecto.NoResultsError if the User does not exist.

Examples

iex> get_user!(123)
%User{}

iex> get_user!(456)
** (Ecto.NoResultsError)
Link to this function get_user_by_username!(username) View Source

Gets a single user.

Raises Ecto.NoResultsError if the User does not exist.

Examples

iex> get_user_by_username!("alice")
%User{}

iex> get_user_by_username!("bob")
** (Ecto.NoResultsError)

Returns the list of users.

Examples

iex> list_users()
[%User{}, ...]
Link to this function update_user(user, attrs) View Source

Updates a user (only allow change password).

Examples

iex> update_user(user, %{field: new_value})
{:ok, %User{}}

iex> update_user(user, %{field: bad_value})
{:error, %Ecto.Changeset{}}