View Source Rivet.Email.Template behaviour (rivet_email v1.1.0)

Link to this section Summary

Link to this section Types

@type ecto_p_result() :: {:ok | :error, Ecto.Changeset.t()}
@type id() :: Ecto.UUID.t()
@type model_p_result() :: {:ok, Rivet.Email.Template.t()}
@type t() :: %Rivet.Email.Template{
  __meta__: Ecto.Schema.Metadata.t(),
  data: String.t() | nil,
  id: binary() | nil,
  inserted_at: DateTime.t() | nil,
  name: String.t() | nil,
  updated_at: DateTime.t() | nil
}

Link to this section Callbacks

Link to this callback

generate(recipient, attributes)

View Source
@callback generate(recipient :: map(), attributes :: map()) ::
  {:ok, subject :: String.t(), html_body :: String.t()}
Link to this callback

send(recipients, assigns)

View Source
@callback send(recipients :: any(), assigns :: list()) :: :ok

Link to this section Functions

Link to this function

all(clauses \\ [], args \\ [])

View Source
@spec all(keyword() | Ecto.Query.t(), list()) ::
  {:error, ecto_p_result()} | {:ok, [Rivet.Email.Template.t()]}
Link to this function

all!(clauses \\ [], args \\ [])

View Source
@spec all!(keyword() | Ecto.Query.t(), list()) :: [Rivet.Email.Template.t()]
Link to this function

associate(item, var, value)

View Source
Link to this function

change_post(item, params)

View Source

change_post for side effects; should return the item

Note: BE VERY CAREFUL on large impact effects. This can quickly become a performance bottleneck.

Link to this function

change_prep(item, params)

View Source

change_prep alters the params only, and may only return {:ok, params}

@spec create(map()) :: model_p_result() | ecto_p_result()
Link to this function

create_post(item, params)

View Source

create_post for side effects; should return the item

Note: BE VERY CAREFUL on large impact effects. This can quickly become a performance bottleneck.

Link to this function

create_prep(item, params)

View Source

create_prep alters the params only, and may only return {:ok, params}

Link to this function

delete_all(clauses, opts \\ [])

View Source
Link to this function

delete_all_ids(ids, opts \\ [])

View Source
Link to this function

drop_replace(attrs, clauses)

View Source
@spec drop_replace(map(), Keyword.t()) :: model_p_result() | ecto_p_result()
@spec exists?(claims_or_query :: keyword() | term()) :: true | false
Link to this function

full_table_scan(clauses, func)

View Source
@spec html2text(html :: String.t()) :: text :: String.t()

iex> html2text("<b>an html doc</b><p><h1>Header</h1>") "an html doc\r\n\r\n\r\n# Header\r\n"

@spec one(id() | keyword() | Ecto.Query.t(), preload :: list()) ::
  {:ok, Rivet.Email.Template.t()} | {:error, String.t()}
@spec one!(id() | keyword() | Ecto.Query.t(), preload :: list()) ::
  nil | Rivet.Email.Template.t()
Link to this function

preload(item, preloads, opts \\ [])

View Source
@spec preload(Rivet.Email.Template.t(), preloads :: term(), opts :: Keyword.t()) ::
  model_p_result() | ecto_p_result()
Link to this function

preload!(item, preloads, opts \\ [])

View Source
@spec preload!(Rivet.Email.Template.t(), preloads :: term(), opts :: Keyword.t()) ::
  Rivet.Email.Template.t()
@spec replace(map(), Keyword.t()) :: model_p_result() | ecto_p_result()
Link to this function

replace_fill(attrs, clauses)

View Source
@spec replace_fill(map(), Keyword.t()) :: model_p_result() | ecto_p_result()

Similar to replace, but it doesn't remove existing values if the attrs has nil

Update our updated_at but only if it hasn't changed within a minute (less load)

Link to this function

update_all(clauses, set)

View Source
Link to this function

update_fill(item, attrs)

View Source
@spec update_fill(Rivet.Email.Template.t(), attrs :: map()) ::
  model_p_result() | ecto_p_result()
Link to this function

upsert(attrs, on_conflict \\ :nothing)

View Source