Skuld.Effects.Port.Repo (skuld v0.26.0)
View SourceEffectful dispatch facade for Skuld.Effects.Port.Repo.Effectful.
Provides typed public functions returning computation(return_type)
values that dispatch to the configured implementation via the Port
effect. Also provides __key__ helpers for test stub matching.
Summary
Functions
Build a test stub key for the reload! port operation.
Build a test stub key for the load port operation.
Build a test stub key for the preload port operation.
Build a test stub key for the aggregate port operation.
Calculate an aggregate over the given field.
Calculate an aggregate over the given field with options.
Fetch all records matching a queryable.
Fetch all records matching a queryable with options.
Fetch all records matching the given clauses.
Fetch all records matching the given clauses with options.
Delete a record or changeset.
Delete a record or changeset with options.
Delete a record or changeset, raising on failure. Mirrors Ecto.Repo.delete!/2.
Delete a record or changeset with options, raising on failure.
Delete all records matching a queryable.
Check whether any record matching the queryable exists.
Check whether any record matching the queryable exists, with options.
Fetch a single record by primary key. Returns nil if not found.
Fetch a single record by primary key with options.
Fetch a single record by primary key, or dispatch Throw if not found.
Fetch a single record by primary key with options, or dispatch Throw.
Fetch a single record by the given clauses. Returns nil if not found.
Fetch a single record by the given clauses with options.
Fetch a single record by the given clauses, or dispatch Throw if not found.
Fetch a single record by the given clauses with options, or dispatch Throw.
Insert a new record from a changeset or struct.
Insert a new record from a changeset or struct with options.
Insert a new record, raising on failure. Mirrors Ecto.Repo.insert!/2.
Insert a new record with options, raising on failure.
Insert all entries into a schema or source at once.
Insert or update a record depending on whether it has been loaded.
Insert or update a record with options.
Insert or update a record, raising on failure.
Insert or update a record with options, raising on failure.
Load a schema struct or map from raw data. Mirrors Ecto.Repo.load/2.
Fetch a single result from a query. Returns nil if no result.
Fetch a single result from a query with options.
Fetch a single result from a query, or dispatch Throw if no result.
Fetch a single result from a query with options, or dispatch Throw.
Preload associations on a struct, list of structs, or nil.
Preload associations with options.
Execute a raw SQL query. Returns {:ok, result} | {:error, term()}.
Execute a raw SQL query with parameters.
Execute a raw SQL query with parameters and options.
Execute a raw SQL query, raising on error.
Execute a raw SQL query with parameters, raising on error.
Execute a raw SQL query with parameters and options, raising on error.
Reload a struct or list of structs from the data store.
Reload a struct or list of structs with options.
Reload a struct or list of structs, raising if any are not found.
Reload a struct or list of structs with options, raising if not found.
Return a lazy enumerable that emits all records matching a queryable.
Return a lazy enumerable with options.
Update an existing record from a changeset.
Update an existing record from a changeset with options.
Update an existing record, raising on failure. Mirrors Ecto.Repo.update!/2.
Update an existing record with options, raising on failure.
Update all records matching a queryable.
Functions
Build a test stub key for the reload! port operation.
Build a test stub key for the load port operation.
Build a test stub key for the preload port operation.
Build a test stub key for the aggregate port operation.
@spec aggregate(Ecto.Queryable.t(), atom(), atom()) :: Skuld.Comp.Types.computation(term())
Calculate an aggregate over the given field.
@spec aggregate( Ecto.Queryable.t(), atom(), atom(), keyword() ) :: Skuld.Comp.Types.computation(term())
Calculate an aggregate over the given field with options.
@spec all(Ecto.Queryable.t()) :: Skuld.Comp.Types.computation([struct()])
Fetch all records matching a queryable.
@spec all( Ecto.Queryable.t(), keyword() ) :: Skuld.Comp.Types.computation([struct()])
Fetch all records matching a queryable with options.
@spec all_by(Ecto.Queryable.t(), keyword() | map()) :: Skuld.Comp.Types.computation([struct()])
Fetch all records matching the given clauses.
@spec all_by( Ecto.Queryable.t(), keyword() | map(), keyword() ) :: Skuld.Comp.Types.computation([struct()])
Fetch all records matching the given clauses with options.
@spec delete(struct() | Ecto.Changeset.t()) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
Delete a record or changeset.
@spec delete( struct() | Ecto.Changeset.t(), keyword() ) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
Delete a record or changeset with options.
@spec delete!(struct() | Ecto.Changeset.t()) :: Skuld.Comp.Types.computation(struct())
Delete a record or changeset, raising on failure. Mirrors Ecto.Repo.delete!/2.
@spec delete!( struct() | Ecto.Changeset.t(), keyword() ) :: Skuld.Comp.Types.computation(struct())
Delete a record or changeset with options, raising on failure.
@spec delete_all( Ecto.Queryable.t(), keyword() ) :: Skuld.Comp.Types.computation({non_neg_integer(), nil | list()})
Delete all records matching a queryable.
@spec exists?(Ecto.Queryable.t()) :: Skuld.Comp.Types.computation(boolean())
Check whether any record matching the queryable exists.
@spec exists?( Ecto.Queryable.t(), keyword() ) :: Skuld.Comp.Types.computation(boolean())
Check whether any record matching the queryable exists, with options.
@spec get(Ecto.Queryable.t(), term()) :: Skuld.Comp.Types.computation(struct() | nil)
Fetch a single record by primary key. Returns nil if not found.
@spec get(Ecto.Queryable.t(), term(), keyword()) :: Skuld.Comp.Types.computation(struct() | nil)
Fetch a single record by primary key with options.
@spec get!(Ecto.Queryable.t(), term()) :: Skuld.Comp.Types.computation(struct())
Fetch a single record by primary key, or dispatch Throw if not found.
Mirrors Ecto.Repo.get!/2 — in the effectful context this dispatches
Throw instead of raising.
@spec get!(Ecto.Queryable.t(), term(), keyword()) :: Skuld.Comp.Types.computation(struct())
Fetch a single record by primary key with options, or dispatch Throw.
@spec get_by(Ecto.Queryable.t(), keyword() | map()) :: Skuld.Comp.Types.computation(struct() | nil)
Fetch a single record by the given clauses. Returns nil if not found.
@spec get_by( Ecto.Queryable.t(), keyword() | map(), keyword() ) :: Skuld.Comp.Types.computation(struct() | nil)
Fetch a single record by the given clauses with options.
@spec get_by!(Ecto.Queryable.t(), keyword() | map()) :: Skuld.Comp.Types.computation(struct())
Fetch a single record by the given clauses, or dispatch Throw if not found.
Mirrors Ecto.Repo.get_by!/2.
@spec get_by!( Ecto.Queryable.t(), keyword() | map(), keyword() ) :: Skuld.Comp.Types.computation(struct())
Fetch a single record by the given clauses with options, or dispatch Throw.
@spec insert(Ecto.Changeset.t() | struct()) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
Insert a new record from a changeset or struct.
@spec insert( Ecto.Changeset.t() | struct(), keyword() ) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
Insert a new record from a changeset or struct with options.
@spec insert!(Ecto.Changeset.t() | struct()) :: Skuld.Comp.Types.computation(struct())
Insert a new record, raising on failure. Mirrors Ecto.Repo.insert!/2.
@spec insert!( Ecto.Changeset.t() | struct(), keyword() ) :: Skuld.Comp.Types.computation(struct())
Insert a new record with options, raising on failure.
@spec insert_all( Ecto.Queryable.t() | binary(), [map() | keyword()], keyword() ) :: Skuld.Comp.Types.computation({non_neg_integer(), nil | list()})
Insert all entries into a schema or source at once.
@spec insert_or_update(Ecto.Changeset.t()) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
Insert or update a record depending on whether it has been loaded.
@spec insert_or_update( Ecto.Changeset.t(), keyword() ) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
Insert or update a record with options.
@spec insert_or_update!(Ecto.Changeset.t()) :: Skuld.Comp.Types.computation(struct())
Insert or update a record, raising on failure.
@spec insert_or_update!( Ecto.Changeset.t(), keyword() ) :: Skuld.Comp.Types.computation(struct())
Insert or update a record with options, raising on failure.
@spec load( module() | map(), map() | keyword() | {list(), list()} ) :: Skuld.Comp.Types.computation(struct() | map())
Load a schema struct or map from raw data. Mirrors Ecto.Repo.load/2.
@spec one(Ecto.Queryable.t()) :: Skuld.Comp.Types.computation(struct() | nil)
Fetch a single result from a query. Returns nil if no result.
@spec one( Ecto.Queryable.t(), keyword() ) :: Skuld.Comp.Types.computation(struct() | nil)
Fetch a single result from a query with options.
@spec one!(Ecto.Queryable.t()) :: Skuld.Comp.Types.computation(struct())
Fetch a single result from a query, or dispatch Throw if no result.
Mirrors Ecto.Repo.one!/1.
@spec one!( Ecto.Queryable.t(), keyword() ) :: Skuld.Comp.Types.computation(struct())
Fetch a single result from a query with options, or dispatch Throw.
@spec preload( [struct()] | struct() | nil, term() ) :: Skuld.Comp.Types.computation([struct()] | struct() | nil)
Preload associations on a struct, list of structs, or nil.
@spec preload( [struct()] | struct() | nil, term(), keyword() ) :: Skuld.Comp.Types.computation([struct()] | struct() | nil)
Preload associations with options.
@spec query(String.t()) :: Skuld.Comp.Types.computation({:ok, term()} | {:error, term()})
Execute a raw SQL query. Returns {:ok, result} | {:error, term()}.
@spec query(String.t(), list()) :: Skuld.Comp.Types.computation({:ok, term()} | {:error, term()})
Execute a raw SQL query with parameters.
@spec query(String.t(), list(), keyword()) :: Skuld.Comp.Types.computation({:ok, term()} | {:error, term()})
Execute a raw SQL query with parameters and options.
@spec query!(String.t()) :: Skuld.Comp.Types.computation(term())
Execute a raw SQL query, raising on error.
@spec query!(String.t(), list()) :: Skuld.Comp.Types.computation(term())
Execute a raw SQL query with parameters, raising on error.
@spec query!(String.t(), list(), keyword()) :: Skuld.Comp.Types.computation(term())
Execute a raw SQL query with parameters and options, raising on error.
@spec reload(struct() | [struct()]) :: Skuld.Comp.Types.computation(struct() | nil | [struct() | nil])
Reload a struct or list of structs from the data store.
@spec reload( struct() | [struct()], keyword() ) :: Skuld.Comp.Types.computation(struct() | nil | [struct() | nil])
Reload a struct or list of structs with options.
@spec reload!(struct() | [struct()]) :: Skuld.Comp.Types.computation(struct() | [struct()])
Reload a struct or list of structs, raising if any are not found.
@spec reload!( struct() | [struct()], keyword() ) :: Skuld.Comp.Types.computation(struct() | [struct()])
Reload a struct or list of structs with options, raising if not found.
@spec stream(Ecto.Queryable.t()) :: Skuld.Comp.Types.computation(Enum.t())
Return a lazy enumerable that emits all records matching a queryable.
@spec stream( Ecto.Queryable.t(), keyword() ) :: Skuld.Comp.Types.computation(Enum.t())
Return a lazy enumerable with options.
@spec update(Ecto.Changeset.t()) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
Update an existing record from a changeset.
@spec update( Ecto.Changeset.t(), keyword() ) :: Skuld.Comp.Types.computation({:ok, struct()} | {:error, Ecto.Changeset.t()})
Update an existing record from a changeset with options.
@spec update!(Ecto.Changeset.t()) :: Skuld.Comp.Types.computation(struct())
Update an existing record, raising on failure. Mirrors Ecto.Repo.update!/2.
@spec update!( Ecto.Changeset.t(), keyword() ) :: Skuld.Comp.Types.computation(struct())
Update an existing record with options, raising on failure.
@spec update_all(Ecto.Queryable.t(), keyword(), keyword()) :: Skuld.Comp.Types.computation({non_neg_integer(), nil | list()})
Update all records matching a queryable.