View Source StepFlow.Roles (StepFlow v1.8.0)

The Roles context.

Summary

Functions

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

Creates a role.

Deletes a Role.

Gets a single role by name

Gets a single role by name

Gets a single role.

Gets a single role.

Gets a several roles.

Returns the list of roles.

Updates a role.

Functions

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

Examples

iex> change_role(role)
%Ecto.Changeset{source: %Role{}}
Link to this function

create_role(attrs \\ %{})

View Source

Creates a role.

Examples

iex> create_role(%{field: value})
{:ok, %Role{}}

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

Deletes a Role.

Examples

iex> delete_role(role)
{:ok, %Role{}}

iex> delete_role(role)
{:error, %Ecto.Changeset{}}

Gets a single role by name

Examples

iex> get_by(toto)
%Role{}

iex> get_by(tata)
nil

Gets a single role by name

Examples

iex> get_by!(toto)
%Role{}

iex> get_by!(tata)
** (Ecto.NoResultsError)

Gets a single role.

Examples

iex> get_role(123)
%Role{}

iex> get_role(456)
nil

Gets a single role.

Raises Ecto.NoResultsError if the Role does not exist.

Examples

iex> get_role!(123)
%Role{}

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

get_roles(names, result \\ [])

View Source

Gets a several roles.

Examples

iex> get_roles(["toto", "tata"])
[%Role{}, %Role{}]
Link to this function

list_roles(params \\ %{})

View Source

Returns the list of roles.

Examples

iex> list_roles()
[%Role{}, ...]
Link to this function

update_role(role, attrs)

View Source

Updates a role.

Examples

iex> update_role(role, %{field: new_value})
{:ok, %Job{}}

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