packages feed

keiro-dsl-0.9.0.0: test/conformance-process-full/Generated/SurgeDemo/Surge/Projection.hs

{-# LANGUAGE OverloadedRecordDot #-}
-- @generated by keiro-dsl 0.8.0.0 (language keiro-dsl 4) from aggregate Surge; do not edit.
module Generated.SurgeDemo.Surge.Projection
  ( surgeProjection
  , surgeStatusFor
  ) where

import Generated.SurgeDemo.Surge.Domain
import SurgeDemo.Surge.Holes (applySurge)
import Data.Text (Text)
import Keiro.Projection (InlineProjection (..))

-- The deterministic event->status mapping (hole-kind 3, /mapping/), derived
-- from the spec's status-map. The read-model SQL that consumes it lives in
-- the hand-owned Holes module (a DB-coupled hole, delegated to codd).
-- WARNING: no readmodel node declares 'surge'; unqualified SQL depends on search_path.
surgeStatusFor :: SurgeEvent -> Maybe Text
surgeStatusFor = \case
  SurgeThresholdNoted {} -> Just "noted"
  SurgeTimerFired {} -> Just "fired"

surgeProjection :: InlineProjection SurgeEvent
surgeProjection =
  InlineProjection
    { name = "surge-demo-surge-inline"
    , apply = applySurge
    }