FunctionalInMemoryReactionRepository

core.repositories.FunctionalInMemoryReactionRepository
class FunctionalInMemoryReactionRepository[F[_]](state: Ref[F, Map[ReactionId, Reaction]])(implicit evidence$1: Sync[F]) extends ReactionRepository[F]

An in-memory implementation of ReactionRepository for testing and local use.

Type parameters

F

Effect type, such as IO or SyncIO.

Value parameters

state

A Ref encapsulating the mutable map of reactions.

Attributes

Source
InMemoryReactionRepository.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def create(reaction: Reaction): F[Either[ReactionError, Reaction]]

Creates a new reaction.

Creates a new reaction.

Value parameters

reaction

The Reaction instance to add.

Attributes

Returns

Effectful result of Either with an error or the new reaction.

Source
InMemoryReactionRepository.scala
def delete(id: ReactionId): F[Boolean]

Deletes a reaction by its ID.

Deletes a reaction by its ID.

Value parameters

id

The ID of the reaction to delete.

Attributes

Returns

Effectful Boolean indicating if the deletion was successful.

Source
InMemoryReactionRepository.scala
def get(id: ReactionId): F[Option[Reaction]]

Retrieves a reaction by its ID.

Retrieves a reaction by its ID.

Value parameters

id

The ID of the reaction to retrieve.

Attributes

Returns

Effectful optional Reaction. Returns None if not found.

Source
InMemoryReactionRepository.scala