HandlerBuilder

zio.blocks.projection.HandlerBuilder
final class HandlerBuilder[E, A]

Says what an event of type E does to the projected type A. It is returned by Projection.on and is finished by calling one of its methods, each of which returns the Projection with the new handler added.

The methods fall into three groups:

  • whole rows: insert, delete
  • field changes: aggregate, update, updateWithField, updateField
  • anything else: custom

Attributes

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

Members list

Value members

Concrete methods

def aggregate(update: FieldUpdate): Projection[A]

Applies the same FieldUpdate every time this event arrives, whatever the event contains. Typically used for counters on a global projection.

Applies the same FieldUpdate every time this event arrives, whatever the event contains. Typically used for counters on a global projection.

Attributes

Source
Projection.scala
def aggregate(updates: Chunk[FieldUpdate]): Projection[A]

Like the single-update aggregate, applying several updates at once.

Like the single-update aggregate, applying several updates at once.

Attributes

Source
Projection.scala

Same as aggregate(update).

Same as aggregate(update).

Attributes

Source
Projection.scala

Uses any ProjectionAction that f returns, for cases the other methods do not cover, such as Upsert or Noop.

Uses any ProjectionAction that f returns, for cases the other methods do not cover, such as Upsert or Noop.

Attributes

Source
Projection.scala
def delete: Projection[A]

Deletes the entity's row.

Deletes the entity's row.

Attributes

Source
Projection.scala
def insert(f: (E, ProjectionContext) => A): Projection[A]

Inserts the row that f builds from the event and its context.

Inserts the row that f builds from the event and its context.

Attributes

Source
Projection.scala
inline def update(inline selector: A => Any)(f: (E, ProjectionContext) => Any): Projection[A]

Sets one field to the value that f computes from the event. The field is picked with a selector such as _.email, checked at compile time, and mapped to its snake_case column name.

Sets one field to the value that f computes from the event. The field is picked with a selector such as _.email, checked at compile time, and mapped to its snake_case column name.

Attributes

Source
Projection.scala
def updateField(fieldName: String)(f: (E, ProjectionContext) => Any): Projection[A]

Same as updateWithField(fieldName, f).

Same as updateWithField(fieldName, f).

Attributes

Source
Projection.scala
def updateWithField(fieldName: String, f: (E, ProjectionContext) => Any): Projection[A]

Sets the named column to the value that f computes from the event. The name is used exactly as written, so it must already be the column name.

Sets the named column to the value that f computes from the event. The name is used exactly as written, so it must already be the column name.

Attributes

Source
Projection.scala