View Source QuantumStorageEcto.Jobs (Quantum Storage Ecto v0.1.1)
Functions to interact with the job model
Summary
Functions
Deletes a job from the database
Purges all jobs from the database
Deletes a job from the database by its name.
Perform a full update for the job object. This function requires all the job attributes to be updated
Returns all jobs from the database
Inserts a job to the database.
Updates a job with the provided attribute
Functions
@spec delete(job :: QuantumStorageEcto.Job.t() | nil, repo :: module()) :: {:ok, QuantumStorageEcto.Job.t()} | {:error, Ecto.Changeset.t()} | {:error, String.t()}
Deletes a job from the database
Parameters
job
- the job object to deleterepo
- the repo module that should be use to communicate with the database
@spec delete_all(repo :: module()) :: {non_neg_integer(), nil | [term()]}
Purges all jobs from the database
Parameters
repo
- the repo module that should be use to communicate with the database
@spec delete_job_by_name(job_name :: Quantum.Job.name(), repo :: module()) :: {:ok, QuantumStorageEcto.Job.t()} | {:error, Ecto.Changeset.t()}
Deletes a job from the database by its name.
Parameters
job_name
- the job name to deleterepo
- the repo module that should be use to communicate with the database
@spec full_update(job :: QuantumStorageEcto.Job.t(), repo :: module()) :: {:ok, QuantumStorageEcto.Job.t()} | {:error, Ecto.Changeset.t() | String.t()}
Perform a full update for the job object. This function requires all the job attributes to be updated
Parameters
job
- the job to updaterepo
- the repo module that should be use to communicate with the database
@spec get_all(repo :: module()) :: [QuantumStorageEcto.Job.t()]
Returns all jobs from the database
Parameters
repo
- the repo module that should be use to communicate with the database
@spec insert(job_attrs :: map(), repo :: module()) :: {:ok, QuantumStorageEcto.Job.t()} | {:error, Ecto.Changeset.t()}
Inserts a job to the database.
Parameters
job_attrs
- the new job attributesrepo
- the repo module that should be use to communicate with the database
@spec update(job_name :: atom() | reference(), attrs :: map(), repo :: module()) :: {:ok, QuantumStorageEcto.Job.t()} | {:error, Ecto.Changeset.t()}
Updates a job with the provided attribute
Parameters
job_name
- the job name to update. Jobs without atom names are using areference
insteadattrs
- a map with the attributes to updaterepo
- the repo module that should be use to communicate with the database