Skuld.Repo.Effectful behaviour (skuld v0.27.3)
View SourceEffectful behaviour for Skuld.Repo.Contract.
Defines computation-returning callbacks for each Repo operation.
Effectful implementations declare @behaviour Skuld.Repo.Effectful.
Summary
Callbacks
@callback aggregate(queryable :: Ecto.Queryable.t(), aggregate :: atom(), field :: atom()) :: Skuld.Comp.Types.computation(term())
@callback aggregate( queryable :: Ecto.Queryable.t(), aggregate :: atom(), field :: atom(), opts :: keyword() ) :: Skuld.Comp.Types.computation(term())
@callback all(queryable :: Ecto.Queryable.t()) :: Skuld.Comp.Types.computation([struct()])
@callback all(queryable :: Ecto.Queryable.t(), opts :: keyword()) :: Skuld.Comp.Types.computation([struct()])
@callback all_by(queryable :: Ecto.Queryable.t(), clauses :: keyword() | map()) :: Skuld.Comp.Types.computation([struct()])
@callback all_by( queryable :: Ecto.Queryable.t(), clauses :: keyword() | map(), opts :: keyword() ) :: Skuld.Comp.Types.computation([struct()])
@callback delete(struct_or_changeset :: struct() | Ecto.Changeset.t()) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
@callback delete(struct_or_changeset :: struct() | Ecto.Changeset.t(), opts :: keyword()) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
@callback delete!(struct_or_changeset :: struct() | Ecto.Changeset.t()) :: Skuld.Comp.Types.computation(struct())
@callback delete!(struct_or_changeset :: struct() | Ecto.Changeset.t(), opts :: keyword()) :: Skuld.Comp.Types.computation(struct())
@callback delete_all(queryable :: Ecto.Queryable.t(), opts :: keyword()) :: Skuld.Comp.Types.computation({non_neg_integer(), nil | list()})
@callback exists?(queryable :: Ecto.Queryable.t()) :: Skuld.Comp.Types.computation(boolean())
@callback exists?(queryable :: Ecto.Queryable.t(), opts :: keyword()) :: Skuld.Comp.Types.computation(boolean())
@callback get(queryable :: Ecto.Queryable.t(), id :: term()) :: Skuld.Comp.Types.computation(struct() | nil)
@callback get(queryable :: Ecto.Queryable.t(), id :: term(), opts :: keyword()) :: Skuld.Comp.Types.computation(struct() | nil)
@callback get!(queryable :: Ecto.Queryable.t(), id :: term()) :: Skuld.Comp.Types.computation(struct())
@callback get!(queryable :: Ecto.Queryable.t(), id :: term(), opts :: keyword()) :: Skuld.Comp.Types.computation(struct())
@callback get_by(queryable :: Ecto.Queryable.t(), clauses :: keyword() | map()) :: Skuld.Comp.Types.computation(struct() | nil)
@callback get_by( queryable :: Ecto.Queryable.t(), clauses :: keyword() | map(), opts :: keyword() ) :: Skuld.Comp.Types.computation(struct() | nil)
@callback get_by!(queryable :: Ecto.Queryable.t(), clauses :: keyword() | map()) :: Skuld.Comp.Types.computation(struct())
@callback get_by!( queryable :: Ecto.Queryable.t(), clauses :: keyword() | map(), opts :: keyword() ) :: Skuld.Comp.Types.computation(struct())
@callback insert(struct_or_changeset :: Ecto.Changeset.t() | struct()) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
@callback insert(struct_or_changeset :: Ecto.Changeset.t() | struct(), opts :: keyword()) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
@callback insert!(struct_or_changeset :: Ecto.Changeset.t() | struct()) :: Skuld.Comp.Types.computation(struct())
@callback insert!(struct_or_changeset :: Ecto.Changeset.t() | struct(), opts :: keyword()) :: Skuld.Comp.Types.computation(struct())
@callback insert_all( source :: Ecto.Queryable.t() | binary(), entries :: [map() | keyword()], opts :: keyword() ) :: Skuld.Comp.Types.computation({non_neg_integer(), nil | list()})
@callback insert_or_update(changeset :: Ecto.Changeset.t()) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
@callback insert_or_update(changeset :: Ecto.Changeset.t(), opts :: keyword()) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
@callback insert_or_update!(changeset :: Ecto.Changeset.t()) :: Skuld.Comp.Types.computation(struct())
@callback insert_or_update!(changeset :: Ecto.Changeset.t(), opts :: keyword()) :: Skuld.Comp.Types.computation(struct())
@callback one(queryable :: Ecto.Queryable.t()) :: Skuld.Comp.Types.computation(struct() | nil)
@callback one(queryable :: Ecto.Queryable.t(), opts :: keyword()) :: Skuld.Comp.Types.computation(struct() | nil)
@callback one!(queryable :: Ecto.Queryable.t()) :: Skuld.Comp.Types.computation(struct())
@callback one!(queryable :: Ecto.Queryable.t(), opts :: keyword()) :: Skuld.Comp.Types.computation(struct())
@callback query(sql :: String.t()) :: Skuld.Comp.Types.computation({:ok, term()} | {:error, term()})
@callback query(sql :: String.t(), params :: list()) :: Skuld.Comp.Types.computation({:ok, term()} | {:error, term()})
@callback query!(sql :: String.t()) :: Skuld.Comp.Types.computation(term())
@callback query!(sql :: String.t(), params :: list()) :: Skuld.Comp.Types.computation(term())
@callback query!(sql :: String.t(), params :: list(), opts :: keyword()) :: Skuld.Comp.Types.computation(term())
@callback reload(struct_or_structs :: struct() | [struct()]) :: Skuld.Comp.Types.computation(struct() | nil | [struct() | nil])
@callback reload!(struct_or_structs :: struct() | [struct()]) :: Skuld.Comp.Types.computation(struct() | [struct()])
@callback stream(queryable :: Ecto.Queryable.t()) :: Skuld.Comp.Types.computation(Enum.t())
@callback stream(queryable :: Ecto.Queryable.t(), opts :: keyword()) :: Skuld.Comp.Types.computation(Enum.t())
@callback update(changeset :: Ecto.Changeset.t()) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
@callback update(changeset :: Ecto.Changeset.t(), opts :: keyword()) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
@callback update!(changeset :: Ecto.Changeset.t()) :: Skuld.Comp.Types.computation(struct())
@callback update!(changeset :: Ecto.Changeset.t(), opts :: keyword()) :: Skuld.Comp.Types.computation(struct())
@callback update_all( queryable :: Ecto.Queryable.t(), updates :: keyword(), opts :: keyword() ) :: Skuld.Comp.Types.computation({non_neg_integer(), nil | list()})