Rivet.Email.Template behaviour (rivet_email v2.5.0)
View SourceSummary
Functions
change_post for side effects; should return the item
change_prep alters the params only, and may only return {:ok, params}
change_validate is only run for changing existing records
create_post for side effects; should return the item
create_prep alters the params only, and may only return {:ok, params}
create_validate is only run for creating new records
iex> html2text("<b>an html doc</b><p><h1>Header</h1>") "an html doc \n# Header"
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)
a hook if you just want to extend validate
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: Rivet.Utils.Ecto.Atom.t() | nil, updated_at: DateTime.t() | nil }
Callbacks
Functions
@spec all(keyword() | Ecto.Query.t(), list()) :: {:error, ecto_p_result()} | {:ok, [Rivet.Email.Template.t()]}
@spec all!(keyword() | Ecto.Query.t(), list()) :: [Rivet.Email.Template.t()]
change_post for side effects; should return the item
Note: BE VERY CAREFUL on large impact effects. This can quickly become a performance bottleneck.
change_prep alters the params only, and may only return {:ok, params}
change_validate is only run for changing existing records
@spec create(map()) :: model_p_result() | ecto_p_result()
create_post for side effects; should return the item
Note: BE VERY CAREFUL on large impact effects. This can quickly become a performance bottleneck.
create_prep alters the params only, and may only return {:ok, params}
create_validate is only run for creating new records
@spec delete(Rivet.Email.Template.t()) :: model_p_result() | ecto_p_result()
@spec drop_replace(map(), Keyword.t()) :: model_p_result() | ecto_p_result()
iex> html2text("<b>an html doc</b><p><h1>Header</h1>") "an html doc \n# Header"
@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()
@spec preload(Rivet.Email.Template.t(), preloads :: term(), opts :: Keyword.t()) :: model_p_result() | ecto_p_result()
@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()
@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)
@spec update(Rivet.Email.Template.t(), map()) :: model_p_result() | ecto_p_result()
@spec update_fill(Rivet.Email.Template.t(), attrs :: map()) :: model_p_result() | ecto_p_result()
a hook if you just want to extend validate