Linkhut.Links (linkhut v0.1.0)
View SourceThe Links context.
Summary
Functions
Returns all non-private links
Returns all Links belonging to the given user.
Returns an %Ecto.Changeset{}
for tracking link changes.
Creates a link.
Deletes a link.
Returns a Link for a given url and user id.
Returns a Link for a given url and user id.
Returns the most recent link modified (as in inserted or updated) by a user
Returns the most popular public links
Returns most recent public links
Returns the unread links for a user
Returns the number of unread links for a user
Updates a link.
Types
@type link() :: %Linkhut.Links.Link{ __meta__: term(), inserted_at: term(), is_private: term(), is_unread: term(), language: term(), notes: term(), notes_html: term(), savers: term(), saves: term(), score: term(), tags: term(), title: term(), updated_at: term(), url: term(), user: term(), user_id: term(), variants: term() }
A Link
struct.
Functions
Returns all non-private links
Returns all Links belonging to the given user.
Returns an %Ecto.Changeset{}
for tracking link changes.
Examples
iex> change_link(link)
%Ecto.Changeset{data: %Link{}}
Creates a link.
Examples
iex> create_link(user, %{field: value})
{:ok, %Link{}}
iex> create_link(user, %{field: bad_value})
{:error, %Ecto.Changeset{}}
Deletes a link.
Examples
iex> delete_link(link)
{:ok, %Link{}}
iex> delete_link(link)
{:error, %Ecto.Changeset{}}
Returns a Link for a given url and user id.
Returns nil
if no result is found.
Examples
iex> get("http://example.com", 123)
%Link{}
iex> get("http://example.com", 456)
nil
Returns a Link for a given url and user id.
Raises Ecto.NoResultsError
if the User does not exist.
Examples
iex> get!("http://example.com", 123)
%Link{}
iex> get!("http://example.com", 456)
** (Ecto.NoResultsError)
Returns the most recent link modified (as in inserted or updated) by a user
Returns the most popular public links
Returns most recent public links
Returns the unread links for a user
Returns the number of unread links for a user
Updates a link.
Examples
iex> update_link(link, %{field: new_value})
{:ok, %Link{}}
iex> update_link(link, %{field: bad_value})
{:error, %Ecto.Changeset{}}