View Source YaBTT.Schema.Torrent (YaBTT v0.1.5)

The schema for torrents.

fields

Fields

  • info_hash - The info hash of the torrent.
  • peers - The peers that are currently seeding or leeching the torrent.

associations

Associations

  • peers - The peers that are currently seeding or leeching the torrent.

indexes

Indexes

  • info_hash - The info hash of the torrent.

Link to this section Summary

Functions

A torrent can be created or updated with a changeset. The changeset requires the info_hash to be present.

Link to this section Types

@type changeset_t() :: Ecto.Changeset.t(t())
@type params() :: map()
@type t() :: %YaBTT.Schema.Torrent{
  __meta__: term(),
  info_hash: term(),
  inserted_at: term(),
  peers: term(),
  updated_at: term()
}

Link to this section Functions

Link to this function

changeset(torrent, params)

View Source
@spec changeset(changeset_t() | t(), params()) :: changeset_t()

A torrent can be created or updated with a changeset. The changeset requires the info_hash to be present.

parameters

Parameters

  • torrent - The torrent to validate.
  • params - The parameters to validate.

examples

Examples

iex> alias YaBTT.Schema.Torrent
iex> Torrent.changeset(%Torrent{}, %{
...>   "info_hash" => <<18, 52, 86, 120, 154, 188, 222, 241, 35, 69, 103, 137, 171, 205, 239, 18, 52, 86, 120, 154>>})
#Ecto.Changeset<action: nil, changes: %{info_hash: <<18, 52, 86, 120, 154, 188, 222, 241, 35, 69, 103, 137, 171, 205, 239, 18, 52, 86, 120, 154>>}, errors: [], data: #YaBTT.Schema.Torrent<>, valid?: true>