View Source QuantumStorageEcto.Jobs (Quantum Storage Ecto v0.2.0)

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 delete
  • repo - 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
Link to this function

delete_job_by_name(job_name, repo)

View Source
@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 delete
  • repo - 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 update
  • repo - 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 attributes
  • repo - the repo module that should be use to communicate with the database
Link to this function

update(job, attrs, repo)

View Source
@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 a reference instead
  • attrs - a map with the attributes to update
  • repo - the repo module that should be use to communicate with the database