Back.Comments (CAMI-Back v0.1.0)

View Source

The Comments context.

Summary

Functions

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

Creates a comment.

Deletes a comment.

Gets a single comment.

Returns the list of comment.

Updates a comment.

Functions

change_comment(comment, attrs \\ %{})

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

Examples

iex> change_comment(comment)
%Ecto.Changeset{data: %Comment{}}

create_comment(attrs \\ %{})

Creates a comment.

Examples

iex> create_comment(%{field: value})
{:ok, %Comment{}}

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

delete_comment(comment)

Deletes a comment.

Examples

iex> delete_comment(comment)
{:ok, %Comment{}}

iex> delete_comment(comment)
{:error, %Ecto.Changeset{}}

get_comment!(id)

Gets a single comment.

Raises Ecto.NoResultsError if the Comment does not exist.

Examples

iex> get_comment!(123)
%Comment{}

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

list_comment()

Returns the list of comment.

Examples

iex> list_comment()
[%Comment{}, ...]

update_comment(comment, attrs)

Updates a comment.

Examples

iex> update_comment(comment, %{field: new_value})
{:ok, %Comment{}}

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