Mirage.Tags (mirage v0.76.0)

The Tags context.

Link to this section Summary

Functions

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

Creates a tag.

Deletes a tag.

Gets a single tag.

Gets a single tag.

Returns the list of tags.

Updates a tag.

Link to this section Functions

Link to this function

change_tag(tag, attrs \\ %{})

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

Examples

iex> change_tag(tag)
%Ecto.Changeset{data: %Tag{}}
Link to this function

create_tag(attrs \\ %{})

Creates a tag.

Examples

iex> create_tag(%{field: value})
{:ok, %Tag{}}

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

delete_tag(tag)

Deletes a tag.

Examples

iex> delete_tag(tag)
{:ok, %Tag{}}

iex> delete_tag(tag)
{:error, %Ecto.Changeset{}}

Gets a single tag.

Returns nil if the Tag does not exist.

Examples

iex> get_tag(123)
%Tag{}

iex> get_tag(456)
nil

Gets a single tag.

Raises Ecto.NoResultsError if the Tag does not exist.

Examples

iex> get_tag!(123)
%Tag{}

iex> get_tag!(456)
** (Ecto.NoResultsError)

Returns the list of tags.

Examples

iex> list_tags()
[%Tag{}, ...]
Link to this function

update_tag(tag, attrs)

Updates a tag.

Examples

iex> update_tag(tag, %{field: new_value})
{:ok, %Tag{}}

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