Skip to content

Refactor repositories to collection-oriented #56

Open
@gregbrowndev

Description

@gregbrowndev

Repositories should follow a collection-oriented style with a save function to handle upserting the object as a unit of state.

Example:

trait JobRepository[F[_]: MonadCancelThrow] {
  def nextIdentity(): F[JobId]

  def save(job: Job): EitherT[F, String, Unit]

  def delete(job: Job): EitherT[F, String, Unit]

  def get(id: JobId): EitherT[F, String, Job]

  def find(
      filterOpt: Option[JobFilter],
      paginationOpt: Option[Pagination]
  ): F[List[Job]]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions